Undefined variable errors laravel 5.2

Undefined variable errors laravel 5.2

Undefined variable errors laravel 5.2. While working on a laravel project i have that problem it show the Errorexception undefined variable errors, After searching over the google i have found the solution and let sharing with you.

This is a breaking problem with the 5.2 upgrade. What’s happening is the middleware which is responsible for making that errors variable available to all your views is not being utilized because it was moved from the global middleware to the web middleware group.

There are two ways to solve this problem:

In your kernel.php file (app/Http/Kernel.php), you can move the middleware \Illuminate\View\Middleware\ShareErrorsFromSession::class back to the protected $middleware property.

Wrap all your web routes with a route group and apply the web middleware to them: now add route like follwoing way.

Sandeep Kumar

Sandeep kumar is a web developer and a professinal blogger. He works for latest technologies and write articles what he learn. In ICodeHub he share web languages tutorials and other programming tips and tricks. if you need some help or have some suggestion then mail him at sandeep92pal@gmail.com without any hesitation. He believes in learning and sharing.