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