I am using code that is below for admin routing in laravel.
Route::group(['prefix' => 'admin'], function() {
Route::get('/', 'Admin\AdminController@home');
Route::get('/users/userList', 'Admin\UserController@userList');
Route::get('/users/detail', 'Admin\UserController@detail');
Route::get('/posts/view', 'Admin\PostController@view');
Route::get('/posts/edit', 'Admin\PostController@edit');
Route::get('/posts/add', 'Admin\PostController@add');
});
This is working fine for me. But when I add new functions in code for that I have to write routing in routes file. For example: If I want to add edit functionality in users controller, for that I have to add new route like .
Route::get('/users/edit', 'Admin\UserController@edit');
So I have to add routing for each function.
I want to know How to use wild card for admin routing so that I have to write routing only for controller not for each function for example.
Route::group(['prefix' => 'admin'], function() {
Route::get('/', 'Admin\AdminController@home');
Route::get('/users/:any', 'Admin\UserController@:any');
Route::get('/posts/:any', 'Admin\PostsController@:any');
});
wild card replace the function name, and auto ridirect to that function.