I am in a bit of pickle. I am using Auth::login() to login the administrator. But after I login him (the login passed and at the moment the Auth::check returns true) and use redirect::route() to the admin panel , the Auth::check returns false. I check the other solutions, but my routes are placed in the web middleware group, so the session should be working. Any Ideas?
The last part of authentication
$admin = $this->setAdmin($user);
Auth::login($admin);
return Redirect::route('admin.panel');
Routes (they are also enclosed in ['middleware' => ['web']])
Route::group(['middleware' => 'auth', 'namespace' => 'Admin'], function(){
Route::get('/', [ 'as' => 'admin.panel', 'uses' => 'AdminController@index' ]);
})
Basic middleware
if (Auth::check()) {
return $next($request);
}
return redirect('/');