My 'users' table has a 'role' column and when users are registered or logged in, I want them to be redirected based on their role column. how can I do that?
相关问题
- Laravel Option Select - Default Issue
- Laravel 5.1 MethodNotAllowedHttpException on store
- Laravel - Implicit route model binding with soft d
- laravel : php artisan suddenly stop working
- How to execute MYSQL query in laravel?
相关文章
- laravel create model from custom stub when using p
- send redirect and setting cookie, using laravel 5
- How to send parameters to queues?
- Bcrypt vs Hash in laravel
- Laravel: What's the advantage of using the ass
- How to make public folder as root in Laravel?
- Input file in laravel 5.2?
- What is the difference between Session::set and Se
In laravel 5.7 there is no AuthController.php so you have to go Controllers\Auth\LoginController.php and add the below function,
If the redirect path needs custom generation logic you may define a redirectTo method instead of a redirectTo property
If you are using the Authentication system provided with Laravel you can override the
redirectPath
method in yourAuth\AuthController
.For example, this would redirect a user with role 'admin' to
/admin
and any other user to/account
:You could also use Laravel Authorization (introduced in 5.1.11) to manage role logic.
I added this function to AuthController.php and everything fixed magically
You can do this handle the request in the Middleware RedirectIfAuthenticated.php inside the handle function like this: