承接 lunestudio/filament-navigation-manager 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

lunestudio/filament-navigation-manager

最新稳定版本:0.1.2

Composer 安装命令:

composer require lunestudio/filament-navigation-manager

包简介

A navigation manager for Filament projects.

README 文档

README

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.

Menu Resource

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

Edit Menu

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

Add Item

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

Reorder Items

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

Menu 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.

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-05