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.phpis required insideRoute::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.phpof 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 doesabort_unless(self::isManager(), 403, ...)withisAdmin() || hasAbility('room.manage')(app/Addons/Room/Support/RoomAccess.php:18-23;hasAbilityatapp/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).