Laravel 5.2 Redirect admin page after login as admin -


laravel 5.2 has been out time now. yes, has new auth function good. specially beginners. question, how check if user admin , redirect safely admin/dashboard properly? know 1 way use admin flag in database can of show example?

go authcontroller.php , add method

where role user role defined in database.

protected function authenticated($request,$user){     if($user->role === 'admin'){         return redirect()->intended('admin'); //redirect admin panel     }      return redirect()->intended('/'); //redirect standard user homepage } 

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -