Route group within a group

In Routes, you can create a group within a group, assigning a certain middleware only to some URLs in the "parent" group.

1Route::group(['prefix' => 'account', 'as' => 'account.'], function() {
2 Route::get('login', 'AccountController@login');
3 Route::get('register', 'AccountController@register');
4 
5 Route::group(['middleware' => 'auth'], function() {
6 Route::get('edit', 'AccountController@edit');
7 });
8});

Like our articles?

Become a Premium Member for $129/year or $29/month
What else you will get:
  • 22 courses (477 lessons, total 38 h 20 min)
  • 2 long-form tutorials (one new every week)
  • access to project repositories
  • access to private Discord