You could use
Route::resource('admin/users', 'UserController');
You catch the query like
Redirect::route('admin.users.show', ['users' => 'name']);
...
public function show($username)
{
I'm the type of person who likes grouping routes.. For instance, when I design admin routes.. I usually have the following
Route::group(array('prefix' => 'admin', 'before' => 'user_is_admin'), function(){
Route::group(array('prefix' => 'users'), function(){
Route::get('/', array('as' => 'admin.users.index', 'uses' => 'Admin\Users@index'));
Route::get('create', array('as' => 'admin.users.create', 'uses' => 'Admin\Users@create'));
Route::post('/', array('as' => 'admin.users.store', 'Admin\Users@store'));
Route::group(array('prefix' => '{id}', 'before' => 'valid_user'), function(){
Route::get('/', array('as' => 'admin.users.show', 'uses' => 'Admin\Users@show'));
Route::get('edit', array('as' => 'admin.users.edit', 'uses' => 'Admin\Users@edit'));
Route::patch('/', array('as' => 'admin.users.update', 'uses' => 'Admin\Users@update'));
Route::delete('/', array('as' => 'admin.users.destroy', 'uses' => 'Admin\Users@destroy'));
});
});
});
You'd need to create those two filters in this case of use
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community