Laravel 当用户';提供了用户的角色

Laravel 当用户';提供了用户的角色,laravel,Laravel,如果用户的角色id为4,并且在我的登录方法中该代码满足要求,那么我希望重定向到admin/org/johndoe/或admin/org/johndoe/profile Route::group([ 'namespace' => 'Admin', 'middleware' => 'isAdmin', 'prefix' => 'admin' ], function () { Route::get('/', 'DashboardController@

如果用户的角色id为4,并且在我的登录方法中该代码满足要求,那么我希望重定向到admin/org/johndoe/或admin/org/johndoe/profile

Route::group([
    'namespace' => 'Admin',
    'middleware' => 'isAdmin',
    'prefix' => 'admin'
], function () {

    Route::get('/', 'DashboardController@index')->name('admin.home');
    Route::get('/profile', 'PagesController@profilePage')->name('admin.profiles');
    Route::get('/newsfeed/publish', 'PagesController@createNewsfeed')->name('admin.add-newsfeed');
    Route::get('/newsfeeds', 'PagesController@newsfeedsPage')->name('admin.newsfeeds.index');

});


请帮帮我,如果您使用route::group并配置了正确的权限,我就不是很好了。您不需要使用开关盒来重定向它

您可以检查以参考如何配置。
希望这有助于解决您的问题。

如果您正在使用route::group并配置了正确的权限。您不需要使用开关盒来重定向它

您可以检查以参考如何配置。
希望这有助于解决您的问题。

那么,问题是什么?那么,问题是什么?
 switch(auth()->user()->role_id) {
            case 1 : return redirect()->route('students.dashboard'); break ;
            case 4 : return redirect()->route('admin.home'); break ; 
            case 6 : return redirect()->route('admin.home'); break ; 
            default : return redirect()->back()->withInput($request->only($this->username(), 'remember'))->withErrors($error);
        }