0
基本上我想做的就是自動更改de前綴,所以我只有一個視圖。鏈接可能看起來像這樣。Laravel - 寫什麼來獲取當前前綴{{URL :: to('prefix/search')}}
{{URL::to('california/search')}}
{{URL::to('florida/search')}}
{{URL::to('arkansas/search')}}
我使用Laravel 5.2
這是控制器我使用:
//Controllers for states
Route::group(array('prefix' => 'california', "namespace" => 'Test'), function() {
Route::get("/all", "[email protected]");
Route::get('/search',['uses' => '[email protected]','as' => 'search']);
Route::get('/show/{id}', '[email protected]');
});
Route::group(array('prefix' => 'florida', "namespace" => 'Test'), function() {
Route::get("/all", "[email protected]");
Route::get('/search',['uses' => '[email protected]','as' => 'search']);
Route::get('/show/{id}', '[email protected]');
});
Route::group(array('prefix' => 'arkansas', "namespace" => 'Test'), function() {
Route::get("/all", "[email protected]");
Route::get('/search',['uses' => '[email protected]','as' => 'search']);
Route::get('/show/{id}', '[email protected]');
});
謝謝你,這是我需要的。 –
該解決方案是否有效? – huuuk