Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dcasia/nova-detached-actions
A Laravel Nova tool to allow for placing actions in the Nova toolbar detached from the checkbox selection mechanism.
https://github.com/dcasia/nova-detached-actions
actions button laravel nova
Last synced: about 2 months ago
JSON representation
A Laravel Nova tool to allow for placing actions in the Nova toolbar detached from the checkbox selection mechanism.
- Host: GitHub
- URL: https://github.com/dcasia/nova-detached-actions
- Owner: dcasia
- License: mit
- Fork: true (gobrightspot/nova-detached-actions)
- Created: 2020-05-09T12:25:24.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-05-09T16:51:06.000Z (over 4 years ago)
- Last Synced: 2024-09-17T12:53:04.984Z (about 2 months ago)
- Topics: actions, button, laravel, nova
- Language: Vue
- Size: 590 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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.
![screenshot](https://i.imgur.com/S8GrNFI.png)
## Installation
You can install the package in to a Laravel app that uses [Nova](https://nova.laravel.com) via composer:
```bash
composer require digital-creative/nova-detached-actions
```## Usage
Create a custom Nova Action file:
```bash
php artisan nova:action ExportUsers
```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:
```php
withHeadings()->askForWriterType()->withMeta([
'detachedAction' => true,
'label' => 'Export'
])->confirmButtonText('Export'),
];
}
...
```## License
The MIT License (MIT). Please see [License File](LICENSE) for more information.