Level 70
Hope will work fine for you-
Route::group(['middleware' => 'api', 'as' => 'api/v1'], function () {
Route::resource('subjects', 'SubjectController');
Route::resource('subjects/{subject}/questions', 'QuestionController');
});
Hi,
as you know in the new Laravel version we have all the routes defined in app/Http/routes.php file in web middleware by default. There are my routes:
Route::get('/', function () {
return view('layout');
});
Route::get('/subjects', function () {
return view('layout');
});
Route::group([
'middleware' => 'api',
'prefix' => 'api/v1'
], function () {
Route::resource('subjects', 'SubjectController');
Route::resource('subjects/{subject}/questions', 'QuestionController');
});
As I understand, if I create the group of the routes with api middleware in this file, this group will be automatically nested in the group of the routes with web middleware? Is it possible? Is it a good practice?
Thanks in advance.
Please or to participate in this conversation.