Hey,
i'm working on my first Laravel project but i don't get the authentication working! I just did
php artisan make:auth
The views and routes are working fine! I registered a user, checked the database and everything is set up.
I can login using the view../auth/login and get redirected. But then...
When i go to /auth/login again, i get redirected. So the login page sees me loged in i guess.
But
var_dump(Auth::user());
is always NULL
I tried to set something like this in routes: Route::get('admin', [ 'middleware' => 'auth', 'uses' => 'AdminController@show' ]);
But when i go to ../admin it redirects me to /login instead of /auth/login
aleex, check "app/Http/Kernel.php" where middleware is defined.
There you can check middleware groups. You can see that in the web middleware group you have things for session and cookies (which is used for auth).
Also, theres information on it at https://laravel.com/docs/master/middleware and Laracasts.
Im guessing Rikcons answer is correct, however I just read the problem but did not spend time on it since no using the web middleware is a classic source of errors in laravel 5.2
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community