Modules/Addons/.
Read Fundamentals first if you haven’t.
Generate it
What you get
What you get
How addons differ
Everything happens through four things: routes you register, listeners on core events, Inertia pages
in
register.ts, and your own tables.
Hooking into core
Events are the main integration point. Register them inEventServiceProvider:
Running code on every request
Your provider’s boot code runs once per Octane worker, not once per request, so anything that looks at the incoming request belongs in middleware. Append it to theweb group from your provider:
Affiliates captures ?ref= codes this way. Share Inertia props from a middleware like this too,
never from the provider. See Running under Octane.
Settings
- Flat fields
- Custom UI
- Key-value store
Keep the generated
SettingsController and just change the fields. You get a full admin page with
no React. See the settings section.User-facing routes
routes/web.php
Navigation
There’s no manifest hook for sidebar links. They come from the
SidebarLink table, which admins
manage in the admin panel.category_label and role_category place the link in a sidebar group (general and user are the
default ones). icon is a name from the built-in icon library. The sidebar is memoized per worker, so
the bump() makes the link appear straight away instead of within a minute.
Commands and cron
Touching core data
Adding a column tousers or services is fine. Make it nullable and the migration idempotent:
Test it
1
Enable it
From Admin, Modules. Migrations run, defaults seed, the workers reload, the admin page loads.
2
Trigger each event you listen to
Check the side effects.
3
Disable it, and confirm the app still works completely
Nothing in core should depend on your tables, listeners or routes.
4
Re-enable it
No duplicate rows, no failed migrations.
Worth reading
LoyaltyProgram
Small and event-driven.
News
Content CRUD with admin and public pages.
Affiliates
Listeners, payouts, a console command, 4 React pages.
Forms
The most frontend-heavy, 12 pages.
Affiliates, Blog, KnowledgeBase and News still use an older hand-written service provider.
Copy their features, not their providers.
