Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Filament Navigation Manager Laravel Package

lunestudio/filament-navigation-manager

View on GitHub
Deep Wiki
Context7

Filament Navigation Manager

Latest Version on Packagist Total Downloads

A menu management plugin for Filament.

Installation

You can install the package via composer:

composer require lunestudio/filament-navigation-manager

Then run the installation command to publish migrations and assets:

php artisan filament-navigation-manager:install

After that, you will need to add a plugin to your AdminPanelProvider

public function panel(Panel $panel): Panel
{
    return $panel
        ->default()
        ->id('admin')
        ->path('admin')
        ->plugins([
            // ...$plugins,
            FilamentNavigationManagerPlugin::make(),
        ]);
}

To publish the config file, run:

php artisan vendor:publish --tag="filament-navigation-manager-config"

Here is the content of the published config file:

return [
    'model' => \Lunestudio\FilamentNavigationManager\Models\Menu::class,

    'resources' => [
        'label' => 'Menu',
        'plural_label' => 'Menus',
        'navigation_group' => null,
        'navigation_label' => 'Menus',
        'navigation_icon' => 'heroicon-o-list-bullet',
        'navigation_sort' => null,
        'navigation_count_badge' => false,
        'resource' => \Lunestudio\FilamentNavigationManager\Filament\Resources\MenuResource::class,
    ],

    'linkable' => [
        [
            'model' => \App\Models\User::class,
            'label' => __('Users'),
            'model_prop_to_pluck' => 'name',
            'item_prop_to_text' => 'name',
            'route_name' => 'user',
            'model_prop_to_route' => 'email',
        ],
        // [
        //     'model' => $full_class_name,
        //     'label' => $text_label_to_linkable_type_select,
        //     'model_prop_to_pluck' => $fillable_name,
        //     'item_prop_to_text' => $fillable_name,
        //     'route_name' => $route_name,
        //     'model_prop_to_route' => $fillable_name_and_route_attr,
        // ],
    ],
];

Linkable items must consider the properties of the models and the attributes of the routes.

The properties model_prop_to_pluck, item_prop_to_text, and model_prop_to_route must be fillable.

At the same time, the model_prop_to_route property must be defined with the same name as the model property, and the route must be named.

An example for the linkable User is:

Route::get('/users/{email}', function () {
    return view('dashboard');
})->name('user');

And in the model:

class User extends Authenticatable
{
    protected $fillable = [
        'name',
        'email',
    ];
}

Menu Resource

This is the index page for creating menus.

You can define the following properties: Name, Location, Append profile item and Keep on mobile.

You can also add menu items and define: Parent Item, Linkable Type, Linkable Id, Custom Link, Ícon, Name, Extra Classes and Link Target.

Afterward, you can reorder items by dragging and dropping them.

Menu Blade Component

To make it as easy as possible to output your menu, Lunestudio provides an <x-navigation-manager::menu> blade component.

The default location is main, but you can change it to any registered menu location.

<x-navigation-manager::menu />
<x-navigation-manager::menu menu-location="footer" />

This is the default view

Testing

composer test

Changelog

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

Credits

License

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

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor