Navigation
Larasell allows you to add items to the sidebar navigation of the admin panel.
Adding items
First, create a routes/admin.php file, if it does not exist.
Use the Navigation facade inside routes/admin.php to add an item to the sidebar. Each item needs a label and a route:
1use Larasell\Admin\Facades\Navigation;
2
3Route::get('notes', NotesController::class)->name('notes');
4
5Navigation::add('Notes', 'larasell.admin.notes');The route group inside routes/admin.php prefixes route names with
larasell.admin., so notes becomes larasell.admin.notes. Pass the full
route name to the facade.
Positioning items
By default, the panel appends items to the bottom of the navigation.
To control where an item appears, set an explicit position using the position method:
1Navigation::add('Notes', 'larasell.admin.notes')->position(500);The panel sorts items by position in ascending order.
Placing items relatively
Instead of setting a numeric position, you can place an item before or after an existing one. The
target can be a label or a NavItem enum case:
1use Larasell\Admin\Enums\NavItem;
2use Larasell\Admin\Facades\Navigation;
3
4Navigation::add('Notes', 'larasell.admin.notes')->before('Home');
5Navigation::add('Reports', 'larasell.admin.reports')->after(NavItem::Home);