Basically what I wan't to do is to automatically change de prefix so I only have one view. The links could look something like this.
{{URL::to('california/search')}}
{{URL::to('florida/search')}}
{{URL::to('arkansas/search')}}
I use Laravel 5.2
This is the controllers i use:
//Controllers for states
Route::group(array('prefix' => 'california', "namespace" => 'Test' ), function() {
Route::get("/all", "CalifornaPositionController@all");
Route::get('/search',['uses' => 'CalifornaPositionController@getSearch','as' => 'search']);
Route::get('/show/{id}', 'CalifornaPositionController@show');
});
Route::group(array('prefix' => 'florida', "namespace" => 'Test' ), function() {
Route::get("/all", "FloridadPositionController@all");
Route::get('/search',['uses' => 'FloridadPositionController@getSearch','as' => 'search']);
Route::get('/show/{id}', 'FloridadPositionController@show');
});
Route::group(array('prefix' => 'arkansas', "namespace" => 'Test' ), function() {
Route::get("/all", "ArkansasPositionController@all");
Route::get('/search',['uses' => 'ArkansasPositionController@getSearch','as' => 'search']);
Route::get('/show/{id}', 'ArkansasPositionController@show');
});