Route::group('/api', function() { Route::get('/users', 'UserController@index'); Route::get('/posts', 'PostController@index'); });
Route::group(['middleware' => 'auth'], function() { Route::get('/dashboard', 'DashboardController@index'); Route::get('/profile', 'ProfileController@index'); });In this example, the `auth` middleware is applied to all routes in the group. This can help to ensure that only authenticated users can access the dashboard and profile pages. The PHP Route group library can be found on GitHub at https://github.com/nikic/FastRoute.