Download the PHP package creode/laravel-nova-assets without Composer
On this page you can find all versions of the php package creode/laravel-nova-assets. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download creode/laravel-nova-assets
More information about creode/laravel-nova-assets
Files in creode/laravel-nova-assets
Package laravel-nova-assets
Short Description Takes the existing Laravel Assets module and adds functionality to make it work in Nova.
License MIT
Homepage https://github.com/creode/laravel-nova-assets
Informations about the package laravel-nova-assets
Takes the existing Laravel Assets module and adds functionality to make it work in Nova.
Takes the existing Laravel Assets module and adds hookable functionality to make it work in Nova.
Installation
You can install the package via composer:
You can publish the config file with:
This is the contents of the published config file:
Usage
The purpose of this module is to use the existing assets model class and wrap it into a Nova resource. This allows us to use the existing functionality of the assets module in Nova. We use some hookable functionality which is documented below that gives any child modules the ability to add custom fields and actions to the resource.
Registering Custom Resource Fields
You can register custom resource fields to appear in both the standard Nova pages (detail, edit, create) and the Bulk Asset Upload action. To do this you need to listen for the DefineAssetFieldsEvent
event and add your fields to the $fields
array. For a full list of Nova fields please look at the Nova documentation.
Registering Custom Resource Actions
You can register custom resource actions to appear on the Asset resource. To do this you need to listen for the DefineAssetActionsEvent
event and add your actions to the $actions
array. These just use Nova's standard Actions functionality. For details about defining actions please look at the Nova documentation.
Registering Custom Bulk Asset Fields
You can register custom bulk asset fields to appear on the Bulk Asset Upload action. To do this you need to listen for the DefineBulkAssetFieldsEvent
event and add your fields to the $fields
array. For a full list of Nova fields please look at the Nova documentation.
Insert a field after another one
As of version 1.4.0
of this module, you can now run a helper function to add an attribute in after another one. This can be done by running the following:
This will then inject the field directly after the other. This is useful if you want to add a field after a specific field but don't want to have to worry about the order of the fields in the array. The only caveat here is that if the field with the provided first attribute doesn't exist, it will not add the field.
Permissions
This module exposes a new permission seeder class which will need to be published to your application in order to grant permissions to the new resource. To do this you need to run the following command:
This will create a new AssetRoleAndPermissionSeeder.php
file within your database/seeders
directory. This will need to be run in order to grant permissions to the new resource. You can run this by running the following command:
You should now see in your database a collection of permissions and a new role called asset-manager
. This role will have all the permissions required to manage assets. Before running this, it requires the setup of any tables for the spatie/laravel-permissions
package. Please see the documentation for more information.
Testing
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
- Creode
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-nova-assets with dependencies
creode/laravel-assets Version ^1.4
creode/nova-mime-asset-icon-field Version ^1.0
creode/permissions-seeder Version ^1.0
digital-creative/nova-filepond Version ^1.0.3
illuminate/contracts Version ^10.0 | ^11.0
intervention/image Version ^3.0
laravel/nova Version ^4.27
spatie/laravel-package-tools Version ^1.14.0