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.