Support the ongoing development of Laravel.io →
Authentication
Last updated 2 years ago.
0

Any routes you want to have session support, which auth is using in this case, you have to apply the 'web' middleware group.

0

lagbox said:

Any routes you want to have session support, which auth is using in this case, you have to apply the 'web' middleware group.

can you please explain it with a code snippet ?

0
Solution

You should have something like this in your routes.php file.

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/
Route::group(['middleware' => ['web']], function () {
    //
});

In short, move your route for '/' to a route group that has the 'web' middleware or add the 'web' middleware to the '/' route definition.

0

Thanks :)

0

Sign in to participate in this thread!

Eventy

Your banner here too?

jagroop jagroop Joined 14 Feb 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.