Download the PHP package acerex/filament-menux without Composer
On this page you can find all versions of the php package acerex/filament-menux. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download acerex/filament-menux
More information about acerex/filament-menux
Files in acerex/filament-menux
Package filament-menux
Short Description Another menu builder plugin for filament php
License MIT
Homepage https://github.com/Rex-noir/filament-menux
Informations about the package filament-menux
Good or bad, you decide.
Inspired by existing menu builders, but simplified and easier to customize. Most of the customizations might look trivial, but having to roll your own custom resource and extending the plugin's classes to customize these little things can sometimes become a pain-in-ass (At least in my experience).
Table of Contents
- Installation
- Example Usage
- Static Menus
- Static Menu Items
- Using Custom Models
- Add Model-Based Menu Items
- Modifying the Base Resource Class
- Custom Forms And Tables
- Action Modifiers
- Using Custom Link Target Enum
Installation
You can install the package via composer:
You can publish and run the migrations with:
Optionally, you can publish the views using
And also you need to add the plugin as a source in the theme css.
Example Usage
To start using, add the plugin to the panel you want.
Registering to panel
Just like any other panel plugins, you can register this in your panel provider
Static Menus
With static menus you can limit how many menus can be created except the menus you provided. This is useful, especially for projects where the frontend fetches the menus statically via slug. To pass static menus, you pass the menus to the useStaticMenus method. If you want the plugin to check and create the defined static menus on boot, pass the third second parameter boolean value. By default, it is disabled.
Static Menu Items
Static menu items are shown menu items that you provide from the panel configuration. You can add static menu items like this.
The third argument is optional and can also be any type of backed enum. For consistency, you should use the enum you use for the item form. See Using custom link target enum
Grouped Static Menu Items
You can also pass grouped static menu items. For example:
Or you can pass a function that returns an array. For example:
The passed function is deferred till the plugin is fully booted.
Add Model-Based Menu Items
Inspired by Menu Builder by Ngô Quốc Đạt, this plugin supports registering models and rendering them into menu item list selection.
The model must implement interfaces;
For example;
Set Records Per Page For Menu-Based Menu Items
By default, all menuxable menus are paginated with four records per page. However, you can customize this by providing the number of records you want to query per page via:
Using Custom Models
You can pass your custom models instead of using the default model classes
For Custom Menu Model
Note: Your custom model must extend the plugin's model.
For Custom Menu Item Model
Note: Your custom model must extend the plugin's model.
Modifying the Base Resource Class
The plugin supports modifying the base resource class without having to extend the base class.
Navigation Group
To Set navigation group of the resource, you can do it like this:
Navigation Label
To Set the navigation label of the resource, you can do it like this:
Navigation Icon
To set the navigation icon of the resource, you can do it like this:
Custom Forms and Table
The plugin also allows you to set custom form and table.
Custom Menu Form With Traditional Class
The custom form must extend the plugin's class. For example:
Custom Menu Form With Anonymouse Class
Also, you can pass the anonymouse class
Custom Menus Table
You can also pass custom menus table with both traditional class and function that returns anonymouse class that extends the base MenuTables class, For example.
or
Custom Menu Item Form
You can also use your own custom menu item form. Pass your menu item for the class that extends the plugin base class.
You can also pass callable that returns anonymouse class too.
To modify the creation of menu items, see the Action Modifiers section.
Action Modifiers
You can modify actions defined in the . List of actions modifiable via the panel,
To modify each action, you pass the action type and return the Action instance. For example, with closure:
Here the closure receives the Filament Action instance, and the plugin merges it with the default configurations.
Also, you can pass class-based Action Modifiers. For example,
and in the panel register the modifier
Using Custom Link Target Enum
By default, the plugin uses for model cast and inside menu item form. But sometimes, you would like to show fewer options or modify the labeling. Or add some more functionality. To do that, you can pass your own enum, and that enum will be used inside the menu item form and the model cast.
The custom enum must implement two interfaces;
For example
License
The MIT License (MIT). Please see License File for more information.
All versions of filament-menux with dependencies
filament/filament Version ^4.0
kalnoy/nestedset Version ^6.0
spatie/laravel-package-tools Version ^1.15.0
spatie/laravel-sluggable Version ^3.7