trevodo said:
The first route is hit, Auth::check() returns false so the block moves on to creating the login page.
Route::get('/', function() { if (Auth::check()) { if(Auth::user()->hasRole('employee')) { return Redirect::to('Employees/Shifts'); } else { return Redirect::to('Admin/Employees'); } } else { return View::make('login'); } });
The issue is that the routes are generated before the Auth
is initiated. Essentially, Auth::check()
will always be false
. This check must be done instead in Laravel 5's middleware or Laravel 3-4's filters.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community