Middleware, how to redirect after check Laravel 5

后端 未结 3 944
情深已故
情深已故 2021-01-02 09:18

I need after check if user is logged as editor, to redirect to profile page...

Here is my code:



        
3条回答
  •  心在旅途
    2021-01-02 10:05

    I found this to be a less code and less decisions for redirecting users based on roles, Put this in your AuthController.php

    protected function authenticated( $user)
    {
    
        if($user->user_group == '0') {
            return redirect('/dashboard');
        }
    
        return redirect('my-account');
    }
    

    https://laracasts.com/discuss/channels/laravel/how-best-to-redirect-admins-from-users-after-login-authentication

提交回复
热议问题