Using the Blade Directive in the Blade Directive

I am using Laravel 5.1. I am trying to use the Blade directive ( @extend ) with my custom Blade directive.

 Blade::directive('base', function() use ($theme) { return "@extends($theme)" }); 

However, the above code only literally displays the content ( @extends($theme) )

+6
source share
1 answer

Unlike the comment I made earlier, I think this is possible (but not verified) using the blade compiler.

 Blade::directive('base', function() use ($theme) { return Blade::compileString("@extends({$theme})"); }); 
+3
source

Source: https://habr.com/ru/post/989485/


All Articles