我有一個控制器ManageController
無消息:HttpException上改變路線定製儀表板laravel
public function index()
{
return redirect()->route('manage.dashboard');
}
public function dashboard()
{
return view('admin.manage.dashboard');
}
和路線:
Auth::routes();
Route::prefix('manage')->middleware('role:superadministrator|administrator|editor')
->group(function() {
Route::get('/', '[email protected]');
Route::get('/dashboard', '[email protected]')->name('manage.dashboard');
Route::resource('/users', 'UserController');
Route::resource('/permissions', 'PermissionController', ['except' => 'destroy']);
Route::resource('/roles', 'RoleController', ['except' => 'destroy']);
});
而且在LoginController
編輯一行: protected $redirectTo = '/manage/dashboard';
我遇到的麻煩是我得到錯誤
Symfony \ Component \ HttpKernel \ Exception \ HttpException No message
登錄後沒有消息的應用程序laravel.log
。和網址,http://localhost:8000/manage/dashboard
'$保護redirectTo = '/管理/儀表板';''不保護$ redirectTo =路徑(」 manage.dashboard');'?好吧,不確定。 –
@TanjaForsberg也許問題出在'角色'中間件(檢查你是否有這些指定的角色),否則你可以看到堆棧跟蹤。 – ako