Skip to content Skip to footer navigation

Controllers

Controllers group related Laravel request handling logic into single classes stored in the app/Http/Controllers/ directory. Use them to build frontend areas or full custom apps, the Laravel way!

Overview#

Statamic is a package sitting inside a standard Laravel application, giving you the freedom to create your own routes, map them to controllers, and build your own custom application and business logic outside of Statamic's feature set.

Anything you can do in Laravel you can do here. Because you're using Laravel. You just also have access to all of Statamic's capabilities and features.

Routes#

Routes are defined in routes/web.php.

Hot Tip!

These explicitly defined routes will take precedence over Statamic routes and URL patterns. Keep this in mind.

A troll pointing a teaching stick

For example, you can map a GET request to yoursite.com/example to the index method in the app/Http/Controllers/ExampleController.php file like this:

use App\Http\Controllers\ExampleController;
Route::