$router->get('/examples', [ExampleController::class, 'index'], 'example.index');
$router->post('/examples', [ExampleController::class, 'store'], 'example.store');
$router->get('/examples/{slug}', [ExampleController::class, 'show'], 'example.show');The third argument is a name, and $router->url('example.show', ['slug' => $x]) builds an address from it. Build links that way in PHP rather than writing them out, or they drift until every one is a 404.
Admin routes go behind the middleware:
$router->group()->prefix('/admin/examples')
->middleware(RequireAdmin::class)
->group(function ($router) { ... });🚨 Register literal paths before patterns. With /examples/{slug} first, a route for /examples/new is never reached — and worse, an example actually slugged "new" becomes unreadable.
To claim the site root, guard it: if ($app->make('applications')->ownsFrontPage('example')).