skyraptor/filament-navigation
Composer 安装命令:
composer require skyraptor/filament-navigation
包简介
Build structured navigation menus in Filament.
README 文档
README
This is a fork of FilamentNavigation extended with translation support.
This plugin for Filament provides a Navigation resource that allows to build structural navigation menus with ease.
Installation
Begin by installing this package via Composer:
composer require skyraptor/filament-navigation
Publish the package's assets:
php artisan vendor:publish --tag="filament-navigation-assets"
Usage
The NavigationResource is automatically registered with Filament so no configuration is required to start using it.
If you wish to customise the navigation group, sort or icon, you can use the respective NavigationResource::navigationGroup(), NavigationResource::navigationSort() and NavigationResource::navigationIcon() methods.
Data structure
Each navigation menu is required to have a name and handle. The handle should be unique and used to retrieve the menu.
Items are stored inside of a JSON column called items. This is a recursive data structure that looks like:
[
{
"label": "Home",
"type": "external-link",
"data": {
"url": "/",
"target": "_blank",
},
"children": [
// ...
],
}
]
The recursive structure makes it really simple to render nested menus / dropdowns:
<ul> @foreach($menu->items as $item) <li> {{ $item['label'] }} @if($item['children']) <ul> {{-- Render the item's children here... --}} </ul> @endforeach </li> @endforeach </ul>
Retrieving a navigation object
To retreive a navigation object, provide the handle to the RyanChandler\FilamentNavigation\Facades\FilamentNavigation::get() method.
use RyanChandler\FilamentNavigation\Facades\FilamentNavigation; $menu = FilamentNavigation::get('main-menu');
Custom item types
Out of the box, this plugin comes with a single "item type" called "External link". This item type expects a URL to be provided and an optional "target" (same tab or new tab).
It's possible to extend the plugin with custom item types. Custom item types have a name and an array of Filament field objects that will be displayed inside of the "Item" modal.
This API allows you to deeply integrate navigation menus with your application's own entities and models.
use RyanChandler\FilamentNavigation\Facades\FilamentNavigation; FilamentNavigation::addItemType('Post link', [ Select::make('post_id') ->searchable() ->options(function () { return Post::pluck('title', 'id'); }) ]);
All custom fields for the item type can be found inside of the data property on the item.
The Navigation field type
This plugin also provides a custom Filament field that can be used to search and select a navigation menu inside other forms and resources.
use RyanChandler\FilamentNavigation\Filament\Fields\NavigationSelect; ->schema([ NavigationSelect::make('navigation_id'), ])
By default, this field will not be searchable and the value for each option will be the menu id.
To make the field searchable, call the ->searchable() method.
->schema([ NavigationSelect::make('navigation_id') ->searchable(), ])
If you wish to change the value for each option, call the ->optionValue() method.
->schema([ NavigationSelect::make('navigation_id') ->optionValue('handle'), ])
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.
skyraptor/filament-navigation 适用场景与选型建议
skyraptor/filament-navigation 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 513 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 06 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「ryangjchandler」 「filament-navigation」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 skyraptor/filament-navigation 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 skyraptor/filament-navigation 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 skyraptor/filament-navigation 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Build structured navigation menus in Filament.
Minimalistic token-based authentication for Laravel API endpoints.
A dead-simple comments package for Laravel.
Build structured navigation menus in Filament.
Store your Laravel application settings in an on-disk JSON file.
Navigation menus package for AdminKit
统计信息
- 总下载量: 513
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 14
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-06-16