PHPackages                             mttzzz/nova-detached-actions - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Admin Panels](/categories/admin)
4. /
5. mttzzz/nova-detached-actions

ActiveLibrary[Admin Panels](/categories/admin)

mttzzz/nova-detached-actions
============================

A Laravel Nova tool to allow for placing actions in the Nova toolbar detached from the checkbox selection mechanism.

2.0.1(3y ago)034MITVuePHP &gt;=7.1.0

Since May 8Pushed 3y agoCompare

[ Source](https://github.com/mttzzz/nova-detached-actions)[ Packagist](https://packagist.org/packages/mttzzz/nova-detached-actions)[ RSS](/packages/mttzzz-nova-detached-actions/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (18)Used By (0)

Laravel Nova Detached Actions Tool
==================================

[](#laravel-nova-detached-actions-tool)

A Laravel Nova tool to allow for placing actions in the Nova toolbar, detached from the checkbox selection mechanism.

⚠️ 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. ⚠️ Also, keep in mind, pivot actions are not supported and have not been tested.

[![screenshot](https://camo.githubusercontent.com/e79bd299ae4f076f731acc8f4de9629163da4b725e1c53578d14b7ed3e6bc761/68747470733a2f2f692e696d6775722e636f6d2f533847724e46492e706e67)](https://camo.githubusercontent.com/e79bd299ae4f076f731acc8f4de9629163da4b725e1c53578d14b7ed3e6bc761/68747470733a2f2f692e696d6775722e636f6d2f533847724e46492e706e67)

Installation
------------

[](#installation)

You can install the package in to a Laravel app that uses [Nova](https://nova.laravel.com) via composer:

```
composer require gobrightspot/nova-detached-actions
```

The tool will be automatically registered via the `ToolServiceProvider`

Usage
-----

[](#usage)

Create a custom Nova Action file:

```
php artisan nova:action ExportUsers
```

Instead of extending the `ExportUsers` class with the `Laravel\Nova\Actions\Action` class, swap it with the `Brightspot\Nova\Tools\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`.

By default, the detached action will only appear on the Index Toolbar.

If you want to also show the action on the resource index view (when users select a row with a checkbox), set the `$public $showOnIndex = true;`If you want to also show the action on the resource detail view (when user selects the action from the dropdown), set the `$public $showOnDetail = true;`

Here's a full example:

```
