bambamboole/filament-menu

Create menus with ease in Filament

Fund package maintenance!
bambamboole

Installs: 117

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/bambamboole/filament-menu

0.2.1 2026-02-22 01:01 UTC

This package is auto-updated.

Last update: 2026-02-22 01:12:42 UTC


README

Latest Version on Packagist GitHub Tests Action Status Total Downloads

A menu builder plugin for Filament that lets you create and manage navigation menus with drag-and-drop ordering, nesting, and linkable Eloquent models.

Installation

composer require bambamboole/filament-menu

Add the plugin views to your custom theme's CSS file:

@source '../../../../vendor/bambamboole/filament-menu/resources/**/*.blade.php';

Usage

Register the plugin in your panel provider:

use Bambamboole\FilamentMenu\FilamentMenuPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            FilamentMenuPlugin::make()
                ->locations(['header', 'footer', 'sidebar'])
                ->linkables([Page::class, Post::class])
                ->canAccess(fn () => auth()->user()->isAdmin())
                ->cacheFor(3600),
        ]);
}
Method Description
locations(array) Named positions where menus can be assigned (e.g. header, footer)
linkables(array) Eloquent models that can be linked as menu items
canAccess(Closure) Controls who can manage menus
cacheFor(int) Cache duration in seconds (auto-invalidated on changes)

Linkable Models

To let editors link menu items to your Eloquent models, implement the Linkable interface:

use Bambamboole\FilamentMenu\Contracts\Linkable;
use Bambamboole\FilamentMenu\Concerns\IsLinkable;
use Illuminate\Database\Eloquent\Builder;

class Page extends Model implements Linkable
{
    use IsLinkable;

    public static function getLinkableQuery(): Builder
    {
        return static::query()->where('published', true);
    }

    public static function getNameColumn(): string
    {
        return 'title';
    }

    public function getLink(): string
    {
        return route('pages.show', $this->slug);
    }
}

The IsLinkable trait provides sensible defaults — override only what you need.

Rendering Menus

Use the Blade component in your templates:

<x-filament-menu::menu location="header" />

<x-filament-menu::menu slug="main-navigation" />

Or retrieve menus programmatically:

use Bambamboole\FilamentMenu\Models\Menu;

$menu = Menu::findByLocation('header');
$tree = $menu->getTree(); // array of nested items

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.