How to create custom laravel blade directives?

Admin   Laravel   214  2021-03-16 09:20:04

Hello Friends,

If you have to create custom directives like @yield then here is example. sometimes we are use same code multiple times then you have to create directives. then don't write same code.

Blade allows you to define your own custom directives using the directive method. When the Blade compiler encounters the custom directive, it will call the provided callback with the expression that the directive contains.