Laravel — P68: Defining Custom Directives in Blade
How many times have you wished that a specific directive existed in Blade? If the answer to that question is “many,” then do I have a surprise for you. You can create your own directives in Blade.
First, you need to create a service provider using the
php artisan make:provider command. This provider will register your Blade directives with Laravel.