| Package Data | |
|---|---|
| Maintainer Username: | pdmfc | 
| Maintainer Contact: | joao.santos@pdmfc.com (João Santos) | 
| Package Create Date: | 2020-04-06 | 
| Package Last Update: | 2022-02-28 | 
| Language: | Vue | 
| License: | MIT | 
| Last Refreshed: | 2025-10-28 03:08:49 | 
| Package Statistics | |
|---|---|
| Total Downloads: | 706,876 | 
| Monthly Downloads: | 3,910 | 
| Daily Downloads: | 139 | 
| Total Stars: | 37 | 
| Total Watchers: | 0 | 
| Total Forks: | 27 | 
| Total Open Issues: | 15 | 
This package allows you to execute an action directly on your resource table view.
composer require pdmfc/nova-action-button
use App\Nova\Actions\ChangeRole;
use Pdmfc\NovaFields\ActionButton;
//...
public function fields()
{
    return [
        ActionButton::make('Action')
            ->action(ChangeRole::class, $this->id)
            //->action(new ChangeRole(), $this->id) using a new instance
    ];
}
The action() method requires two params - the action class name or a new instance, and the target resource id.

You can use the native Laravel nova readonly() method to prevent users from clicking the button:
ActionButton::make('Action')
    ->action(ChangeRole::class, $this->id)
    ->readonly(function () {
        return $this->role->name === 'admin';
    })

To edit the button text content, use the text() method.
->text('Execute')
To enable the loading animation on button and change color, use showLoadingAnimation() and loadingColor('#fff') method.
->showLoadingAnimation()
->loadingColor('#fff') # default is #000
In order to add a svg to the button, you first need to create a vue component containing a svg and then pass the component name to the svg() method.
->svg('VueComponentName')
To change button color, use buttonColor('#21b970') method.
->buttonColor('#21b970') # default is .btn-primary color
actions() method.composer.json of a laravel nova application add the following:{
    //...
    "require" {
        "pdmfc/nova-action-button: "*"
    },
    //...
    "repositories": [
        {
            "type": "path",
            "url": "../path_to_your_package_folder"
        }
    ],
}
composer update pdmfc/nova-action-button
You're now ready to start contributing!
Please see CHANGELOG for more information on what has changed recently.