我有一个 Laravel Spark 应用程序,并且想在团队和项目的路由中使用前两个参数,但 about_us、设置、api 等例外。
我已经设置了我的路线,类似于:
Route::pattern('team', '[a-zA-Z0-9-]+');
Route::pattern('project', '[a-zA-Z0-9-]+');
Route::get('/home', 'HomeController@show');
Route::group(['prefix' => '{team}'], function () {
Route::get('/', 'TeamController@dashboard');
Route::group(['prefix' => '{project}'], function () {
Route::get('/', 'ProjectController@dashboard');
...
//Spark defines routes such as /settings after the apps routing file is processed;
//thus I cannot route to /settings as it's caught by /{team}.
我正在努力做两件事之一。或者,从 {team} 模式中排除“api”、“settings”等值;或者让 Laravel Spark 路由在我的 web 路由之前运行,这样我就可以确保在 /{team} 的全部捕获之前检查所有有效路由。
任何想法,将不胜感激!