Created
May 14, 2018 13:21
-
-
Save robozavri/1e239501941b68498d8553f5a7c9b6c7 to your computer and use it in GitHub Desktop.
laraadmin laravel admin redirect if is admin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace App\Http\Controllers\Auth; | |
class LoginController extends Controller | |
public function redirectTo(){ | |
$roles = Auth::user()->roles; | |
if(!is_null($roles )){ | |
foreach (Auth::user()->roles as $role) { | |
if($role->name == "SUPER_ADMIN"){ | |
return '/admin'; | |
} | |
} | |
} | |
return $this->redirectTo; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment