参考:
Laravel 5 redirect intended to different route based on role
https://laracasts.com/discuss/channels/general-discussion/laravel-5-authentication-and-roles
基于版本:Laravel 5.2
在Laravel 5.2中,根据Laravel的make:auth自动生成的代码中:
这个代码段,实现了登陆之后的跳转,我们只需要重写$this->redirectPath()方法即可。
该文件在:RedirectsUsers.php
修改为:
/**
* Get the post register / login redirect path.
*
* @return string
*/
public function redirectPath()
{
// Logic that determines where to send the user
if (\Auth::user()->type == 'admin') {
return '/admin';
}
return '/dashboard';
}
文章的脚注信息由WordPress的wp-posturl插件自动生成

微信扫一扫,打赏作者吧~


