Я думаю, что вы ищете Route::group()
:
//Note: 'middleware' and 'as' are optional.
Route::group(['prefix' => 'foods/fruits', 'middleware' => ['jwt.auth'], 'as' => 'fruits.'], function () {
Route::group(['prefix' => 'apples', 'as' => 'apples.'], function () {
Route::get('/', ['as' => 'list', 'uses' => 'FruitsController@index']);
Route::get('{type}', ['as' => 'show', 'uses' => 'FruitsController@show']);
});
});
$ php artisan route:list
+--------+----------+---------------------------------------+---------------------------------+-----------------------------------------------------------------------------+----------------------------------------------+
| Domain | Method | URI | Name | Action | Middleware |
+--------+----------+---------------------------------------+---------------------------------+-----------------------------------------------------------------------------+----------------------------------------------+
| | GET|HEAD | foods/fruits/apples | fruits.apples.list | App\Http\Controllers\FruitsController@index | jwt.auth |
| | GET|HEAD | foods/fruits/apples/{type} | fruits.apples.show | App\Http\Controllers\FruitsController@show | jwt.auth |
+--------+----------+---------------------------------------+---------------------------------+-----------------------------------------------------------------------------+----------------------------------------------+