add uri parameter to Route name in laravel



PHP Snippet 1:

loop (model in models) 
   Route::get("{model}","Atcion")->name("{model}.index")
endloop

PHP Snippet 2:

 for ($i = 0; $i < 5; $i++) {
     Route::get('test/' . $i, 'Controller@test_' . $i)->name('test.' . $i);
 }

PHP Snippet 3:

 $models = ['user', 'owner', 'admin'];
 foreach ($models as $model) {
     Route::get($model, 'CrudController@index')->name($model . '.index');
 }

PHP Snippet 4:

 'models' => ['user', 'owner', 'admin'];

PHP Snippet 5:

 $models = config('app.models');
 // foreach loop

PHP Snippet 6:

+-----------+----------------------------+-----------------+------------------------------------------------------------+
| Method    | URI                        | Name            | Action                                                     |
+-----------+----------------------------+-----------------+------------------------------------------------------------+
| GET|HEAD  | {model}                    | {model}.index   | App\Http\Controllers\CrudController@index                  |
| POST      | {model}                    | {model}.store   | App\Http\Controllers\CrudController@store                  |
| GET|HEAD  | {model}/create             | {model}.create  | App\Http\Controllers\CrudController@create                 |
| GET|HEAD  | {model}/{id}               | {model}.show    | App\Http\Controllers\CrudController@show                   |
| PUT|PATCH | {model}/{id}               | {model}.update  | App\Http\Controllers\CrudController@update                 |
| DELETE    | {model}/{id}               | {model}.destroy | App\Http\Controllers\CrudController@destroy                |
| GET|HEAD  | {model}/{id}/edit          | {model}.edit    | App\Http\Controllers\CrudController@edit                   |
+-----------+----------------------------+-----------------+------------------------------------------------------------+