Adding a new @expects directive for Laravel's Blade template engine
A good package which we can use to add a new @expects directive for Laravel's Blade template engine.
Blade templates are great, but lacks a good way to define the variables it requires to work. In a normal template you must check if variables are set and/or set a default value for it.
Installation
Just install using composer and Laravel will load it automagically:
composer require vaites/laravel-blade-expects
If you don't want to use the package auto-discovery you will need to add this to the service providers in config/app.php:
'providers' => [
// ...
\Vaites\Laravel\BladeExpects\BladeExpectsServiceProvider::class,
]
Source Code
This post is submitted by our members. Submit a new post.
Tags: Tutorials Packages Sources Laravel 5.8 Laravel 5.7 Laravel 5.6 Laravel 5.5 Laravel 5.4 Laravel 5.3 Laravel 5 Intermediate