2016-11-20

I am using Laravel 5.3. My first Laravel project/learning experience
In my blade file I use the following snippet to show the errors below a field after a PUT or POST request.

In this case the database field is called firstName

Now since I have lot of fields, I have keep repeatings this block for every field. I looked up the Laravel docs on Blade templates (Extending Blade section) and thought I could do the following in the AppServiceProvider class (AppServiceProvider .php)

and then use

@showIfError('firstName')

But no luck...I get the error 'Undefined variable: errors'

Looks like the Laravel error collection is not accessible in this view file.

Appreciate any help. Thanks.

Show more