How to override the default launch function of a blade in laravel 5?

I almost solved my problem in this matter . Now I have to find a way to override the default blade shutdown function. I think there is a way to create a class that extends and overrides the behavior of the BladeCompiler class, so I could do something like this:

class MyCustomCompiler extends BladeCompiler{ function compileEscapedEchos($value){ return parent::compileEscapedEchos(utf8_encode($value)); } } 

If I could do this, I would have to use larvel instead of MyCustomCompiler instead of BladeCompiler. How can i do this?

+2
php dependency-injection laravel-5
source share
1 answer

You don’t even need to redefine the compiler, just do this from your service provider:

 Blade::setEchoFormat('e(utf8_encode(%s))'); 

This will change the way {{ ... }} compiled. The default format is e(%s) .

+2
source share

All Articles