Download the PHP package digital-creative/nova-detached-actions without Composer
On this page you can find all versions of the php package digital-creative/nova-detached-actions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download digital-creative/nova-detached-actions
More information about digital-creative/nova-detached-actions
Files in digital-creative/nova-detached-actions
Package nova-detached-actions
Short Description A Laravel Nova tool to allow for placing actions in the Nova toolbar detached from the checkbox selection mechanism.
License MIT
Informations about the package nova-detached-actions
Laravel Nova Detached Actions Tool
A Laravel Nova tool to allow for placing actions in the Nova toolbar, detached from the checkbox selection mechanism.
:warning: Keep in mind, since the action is detached from the row selection checkboxes in the resource table, you will not have a collection of models to iterate over. Detached actions are intended to be independent of the selection in the table.
Installation
You can install the package in to a Laravel app that uses Nova via composer:
Usage
Create a custom Nova Action file:
Instead of extending the ExportUsers
class with the Laravel\Nova\Actions\Action
class, swap it with the DigitalCreative\DetachedActions\DetachedAction
class.
Since we won't receive a collection of $models
, you can remove the variable from the handle
method, so that the signature is public function handle(ActionFields $fields)
.
You can also customize the button label, by overriding the label()
method. If you do not override the label, it will 'humanize' the class name, in the example ExportUsers
would become Export Users
.
Here's a full example:
Register the action on your resource:
Usage with the Laravel Nova Excel DownloadExcel
action
You can easily integrate the DetachedAction
tool with the Laravel Nova Excel DownloadExcel
action by simply passing some additional data along using withMeta()
.
License
The MIT License (MIT). Please see License File for more information.