Skip to content Skip to footer navigation
You are reading the Statamic 6 Alpha docs. 👀

Routing

You can register Control Panel routes to build custom pages.

Hot Tip!

This guide is intended for apps adding routes to the Control Panel. If you're building an addon, please see our Building an Addon guide instead.

A troll pointing a teaching stick

To register a custom route:

  1. Create a routes file. Name it whatever you want, for example: routes/cp.php

  2. Then push the routes by adding this to your app/Providers/AppServiceProvider.php:

    use Illuminate\Support\Facades\Route;
    use Statamic\Statamic;
    public function boot()
    {
    Statamic::pushCpRoutes(function () {
    Route::namespace('\App\Http\Controllers')->group(function () {
    require base_path('routes/cp.php');
    });
    });
    }
  3. Any routes in the file will have the appropriate name prefix and middleware applied.