使用Laravel 5.2应用程序,我已经定义了路线问题。
1。重定向到主页
Route::get('/', ['as' => '/','uses' => 'HomeController@index']);
2。重定向到用户个人资料,即" www.mydomain.com/samrow"
Route::get('/{username?}', ['as' => '/','uses' => 'HomeController@profile']);
第3。未重定向到信息中心,其重定向到个人资料操作
Route::get('/dashboard', ['as' => '/dashboard','uses' => 'HomeController@dashboard']);
提前致谢!
答案 0 :(得分:1)
Laravel使用与请求匹配的第一条路线,因此您定义它们的顺序非常重要。
Route::get('/dashboard', ['as' => '/dashboard','uses' => 'HomeController@dashboard']);
Route::get('/{username?}', ['as' => '/','uses' => 'HomeController@profile']);
// Catch all should always be last
Route::get('/', ['as' => '/','uses' => 'HomeController@index']);