> For the complete documentation index, see [llms.txt](https://sprnva.gitbook.io/sprnva-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sprnva.gitbook.io/sprnva-docs/routing/controller-grouping.md).

# controller grouping

If a group of routes all utilize the same controller, you may use the controller method to define the common controller for all of the routes within the group. Then, when defining the routes, you only need to provide the controller method that they invoke.

```php
Route::controller($param, $action);

// grouping the common controller
// dont write same controller repeatedly
Route::controller(['WelcomeController'], function () {
		
    // you can set the controller method as string
    Route::get('/settings', 'settings');
	
    // you can also set the controller method as array
    Route::get('/settings/add', ['create']);
    
    // you can also add middleware auth to a grouped controller
    // if there's no global middleware set in the parent
    Route::get('/settings/add', ['create', ['auth']]);

});
```
