Navigation
Customize and extend the Shopper control panel navigation
The Control Panel navigation is highly customizable. You can add your own groups, items, and sub-items to it.
The navigation is controlled by the shopper/sidebar package. This package can be used both as a standalone sidebar builder for any Laravel application or to extend Shopper's admin panel.
Quick Start
To add navigation items to Shopper, create a sidebar extension class and register it in your service provider:
namespace App\Sidebar;
use Shopper\Sidebar\AbstractAdminSidebar;
use Shopper\Sidebar\Contracts\Builder\Group;
use Shopper\Sidebar\Contracts\Builder\Item;
use Shopper\Sidebar\Contracts\Builder\Menu;
class BlogSidebar extends AbstractAdminSidebar
{
public function extendWith(Menu $menu): Menu
{
$menu->group(__('Blog'), function (Group $group): void {
$group->weight(5);
$group->setAuthorized();
$group->item(__('Posts'), function (Item $item): void {
$item->weight(1);
$item->setAuthorized();
$item->useSpa();
$item->route('shopper.posts.index');
$item->setIcon('phosphor-article');
});
});
return $menu;
}
}Register it in your AppServiceProvider:
namespace App\Providers;
use App\Sidebar\BlogSidebar;
use Illuminate\Support\ServiceProvider;
use Shopper\Sidebar\SidebarBuilder;
class AppServiceProvider extends ServiceProvider
{
public function register(): void
{
$this->app['events']->listen(SidebarBuilder::class, BlogSidebar::class);
}
}The Blog group then shows in the sidebar, and its Posts entry is selected on the page it links to. The shopper.posts.index route is the one registered in Controllers:

Shopper registers its own sidebar listeners in the register() method of a service provider. The sidebar is built later, while the admin request runs, so a listener registered in boot() works too.
API Reference
For a complete API reference, see the detailed documentation:
| Component | Description | Documentation |
|---|---|---|
| Menu | Root container for groups | Standalone Guide |
| Group | Collection of related items | Standalone Guide |
| Item | Navigation entry with icon, badge, etc. | Standalone Guide |
| Badge | Notification indicator | Standalone Guide |
| Append | Action button | Standalone Guide |
Last updated on
Edit on GitHub