/
WebsiteSupport

DocsDeveloper guideBuild an add-on

Routes and controllers

Signed-in pages go in routes.php, public pages in public_routes.php. Both are mounted only while the add-on is installed.

1 min read

  • routes.php is required inside Route::middleware(['web', 'auth']). A routes file that throws is caught inside the group, so it cannot leave the sign-in middleware stuck on later routes (app/Providers/AddonServiceProvider.php:136-162).
  • public_routes.php of every installed add-on is mounted outside the sign-in, after core's / (app/Support/Addons/AddonRoutes.php:9-45).
  • A first URL segment is closed to users without the right ability once you list it in segments (app/Providers/AddonServiceProvider.php:210-227). Check rights again in the controller: Meeting Rooms does abort_unless(self::isManager(), 403, ...) with isAdmin() || hasAbility('room.manage') (app/Addons/Room/Support/RoomAccess.php:18-23; hasAbility at app/Models/User.php:841).
  • Render your pages with Inertia::render('<slug>::<Page>', $props). The namespace is what keeps your page from colliding with a core page (resources/js/app.js:90-93).

See also