Section — a small class of hook methods that a service provider registers before the panel processes it at boot.
Sections
ASection (Lunar\Panel\Sections\Section) is an area of the panel: it owns a key, contributes navigation, and can register routes, table extensions, page actions, slots, dashboard widgets, and more. Every first-party area of the panel — Sales, Catalog, Settings’ sub-sections — is a Section, and an add-on registers its own the same way.
A SectionExtension (Lunar\Panel\Sections\SectionExtension) grafts onto a section owned by someone else instead of standing alone. It supports the same hooks as Section, minus key()/label(), plus one required method:
Section when the add-on stands alone (its own navigation group, its own pages). Use a SectionExtension when it’s conceptually part of an existing area — extra navigation under Sales, say. An extends() key that matches no registered section logs a warning and the extension is skipped, so load order between add-ons never throws.
Registering a section
Register both kinds through theLunar\Panel\Facades\Panel facade:
The hook table
EverySection and SectionExtension implements the same set of hooks, each returning an empty default so overriding one is opt-in.
Section::draftables(), discountTypeForms(), searchSources(), searchCommands(), and widgets() are also available on SectionExtension.
Non-section escape hatches
Everything aSection hook does is a thin wrapper around a method on Lunar\Panel\PanelManager, fronted by the Panel facade. Code that doesn’t fit the shape of an area — a single table extension registered from a package’s own bootstrapping, say — can call these directly instead of writing a Section:
Sections are the organized way of calling these; reach for the escape hatch only when a full
Section class would be pure ceremony.
Where to go next
Building an add-on
Scaffold a distributable Composer + npm package, from the service provider through compiling and shipping the JS bundle.
Pages and navigation
Register routes, build an Inertia page with the standard scaffolding, and add navigation and settings-navigation entries.
Ordering with Position
Anchor navigation items, table columns, and actions relative to each other with
Lunar\Panel\Support\Position.