vendredi 19 janvier 2018

Laravel 5.5 Custom Blade Provider if statement

I would like to make a custom blade provider to clean my code.

public function boot() {
    Blade::if ('hasError', function ($field) {
        return session('errors')->has($field);
    });
}

This is how i use in view:

@hasError('email') has-error @endif

But I get this error message:

Call to a member function has() on null ...

Does anyone have idea?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2mPEvTY
via IFTTT

Aucun commentaire:

Enregistrer un commentaire