Download the PHP package bencolmer/nova-resource-hierarchy without Composer
On this page you can find all versions of the php package bencolmer/nova-resource-hierarchy. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package nova-resource-hierarchy
Nova Resource Hierarchy
This package allows you to display and manage resource hierarchy in a tree view within Laravel Nova.
Features
- Drag-and-drop nesting and reordering
- A large number of configuration options
- Laravel Authorization support
- Localization support
Requirements
Installation Requirements
php: >=8.1laravel/nova: ^5.0
Model Requirements
This package requires your model's database table to have the following columns:
| Column Name | Description |
|---|---|
| id | The model's primary key column |
| parent_id | A self-referencing foreign key column |
| rank | A column recording the order of the hierarchy (optional - only required if enabling reordering) |
You can customize the names of these columns - see customizing model keys below for details.
Installation
-
Install this package via composer:
- Register the tool with Laravel Nova via the
toolsmethod of theNovaServiceProvider.
Next, take a look through the available configuration options.
Configuration
Once you have registered the tool in Nova, you have several configuration options available:
Customizing Model Keys
Set the ID, Parent ID, and order column (optional) names for the underlying model of a resource.
Enable Reordering
Enables reordering of the resource hierarchy (this functionality is disabled by default).
Maximum Depth
Set the maximum hierarchy depth.
By default, the maximum depth is 10.
Available Actions
You can control which actions (Create, View, Update, and Delete) are available.
By default, the Create, View, Update, and Delete actions are available. These actions are protected by authorization policies.
Menu Entry
You can customize the menu entry title/icon:
Alternatively, you can hide the menu entry entirely:
Page Title/Description
You can customize the title of the page and set a description.
Item Title
You can customize the title of each item displayed in the hierarchy.
By default, the resource title will be displayed.
Authorization
This package uses Laravel's authorization policies to check a user's Create / View / Update / Delete permissions.
You can also define one further authorization method to control whether a user is authorized to reorder the resource hierarchy:
-
Apply the
AuthorizesHierarchytrait to your Nova resource: - Define a
reorderHierarchymethod on your Policy class:
Localization & Message Customization
The package translation files can be published using the following command:
You can then edit these files to customize the messages as required.
Credits
License
Nova Resource Hierarchy is open-sourced software licensed under the MIT license.