Download the PHP package pistacchioweb/filament-menu-manager without Composer
On this page you can find all versions of the php package pistacchioweb/filament-menu-manager. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pistacchioweb/filament-menu-manager
More information about pistacchioweb/filament-menu-manager
Files in pistacchioweb/filament-menu-manager
Package filament-menu-manager
Short Description A package to create and manage application menus through Filament
License MIT
Informations about the package filament-menu-manager
Filament Menu Manager
Fork of https://github.com/datlechin/filament-menu-builder. We decided to fork this repository to allow our projects to upgrade to filament V4.
[!NOTE] Not production ready, use it at your own risk.
This Filament package allows you to create and manage menus in your Filament application.

Installation
You need to publish the migrations and run them:
You can publish the config file with:
Optionally, if you want to customize the views, you can publish them with:
This is the contents of the published config file:
Add the plugin to AdminPanelProvider:
Usage
Adding locations
Locations are the places where you can display menus in the frontend. You can add locations in the AdminPanelProvider:
The first argument is the key of the location, and the second argument is the title of the location.
Alternatively, you may add locations using an array:
Setting up Menu Panels
Menu panels are the panels that contain the menu items which you can add to the menus.
Custom Link Menu Panel
By default, the package provides a Custom Link menu panel that allows you to add custom links to the menus.

The panel can be disabled by using the following when configuring the plugin, should you not need this functionality.
Custom Text Menu Panel
This package provides a Custom Text menu panel that allows you to add custom text items to the menus.
It is identical to the Custom Link menu panel except for the fact that you only set a title without a URL or target. This can be useful to add headers to mega-style menus.
The panel is disabled by default to prevent visual clutter. To enable the Custom Text menu panel, you can use the following when configuring the plugin.
Static Menu Panel
The static menu panel allows you to add menu items manually.
Similarily to locations, you may also add static menu items using an array:

Model Menu Panel
The model menu panel allows you to add menu items from a model.
To create a model menu panel, your model must implement the \PistacchioWeb\FilamentMenuManager\Contracts\MenuPanelable interface and \PistacchioWeb\FilamentMenuManager\Concerns\HasMenuPanel trait.
Then you must also implement the getMenuPanelTitleColumn and getMenuPanelUrlUsing methods. A complete example of this implementation is as follows:
Then you can add the model menu panel to the plugin:

Additional Menu Panel Options
When registering a menu panel, multiple methods are available allowing you to configure the panel's behavior such as collapse state and pagination.
Custom Fields
In some cases, you may want to extend menu and menu items with custom fields. To do this, start by passing an array of form components to the addMenuFields and addMenuItemFields methods when registering the plugin:
Next, create a migration adding the additional columns to the appropriate tables:
Once done, simply run php artisan migrate.
Customizing the Resource
Out of the box, a default Menu Resource is registered with Filament when registering the plugin in the admin provider. This resource can be extended and overridden allowing for more fine-grained control.
Start by extending the PistacchioWeb\FilamentMenuManager\Resources\MenuResource class in your application. Below is an example:
Now pass the custom resource to usingResource while registering the plugin with the panel:
Customizing the Models
The default models used by the plugin can be configured and overridden similarly to the plugin resource as seen above.
Simply extend the default models and then pass the classes when registering the plugin in the panel:
Using Menus
Getting the assigned menu for a registered location can be done using the Menu model. Below we will call the menu assigned to the primary location:
Menu items can be iterated from the menuItems relationship:
When a menu item is a parent, a collection of the child menu items will be available on the children property:
Configuring Indent/Unindent Actions
The package includes indent and unindent buttons that provide an alternative to drag-and-drop for organizing menu hierarchy. This feature is enabled by default but can be configured:
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.