I tried to create a new blade directive in my AppServiceProvider:
<?php public function boot() { Blade::directive('test', function () { return Blade::compileString('@if(1==1) test @endif'); }); }
And then call this directive in my view:
@test()
But it’s not work and gives me a blank page.
Advertisement
Answer
i try several things but finally i fix this by copy and paste blade directive code from BladeCompiler.php to my custom directive instead of using compileString