creode / laravel-nova-account-approval
A simple package which integrates with the laravel-account-approval package to grant additional actions within Nova.
Fund package maintenance!
Creode
Requires
- php: ^8.1
- creode/laravel-account-approval: ^1.1
- illuminate/contracts: ^10.0 | ^11.0
- laravel/nova: ^4.32
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.8 | ^8.1
- orchestra/testbench: ^8.8
- pestphp/pest: ^2.20
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
README
A simple package which integrates with the laravel-account-approval package to grant additional actions within Nova.
Installation
You can install the package via composer:
composer require creode/laravel-nova-account-approval
Usage
This package currently just exposes some actions that can be used in Nova resources to activate and deactivate users.
This functionality is tied directly to the laravel-account-approval
package, using it as a dependency of this one.
Setting up the actions
To use the actions, you need to add them to your Nova resource. For example, if you have a User resource, you can add the actions like so:
/** * Get the actions available for the resource. * * @param \Laravel\Nova\Http\Requests\NovaRequest $request * @return array */ public function actions(NovaRequest $request) { return [ (new \Creode\LaravelNovaAccountApproval\Actions\ApproveAccount) ->confirmText('Are you sure you want to approve this account?') ->confirmButtonText('Approve') ->cancelButtonText("Don't Approve"), (new \Creode\LaravelNovaAccountApproval\Actions\DeactivateAccount) ->confirmText('Are you sure you want to deactivate this account?') ->confirmButtonText('Deactivate') ->cancelButtonText("Don't Deactivate"), ]; }
Actions are configured to be both inline and in bulk so they can be used to easily approve/deactivate multiple users at once from the main screen.
It may also be useful to display the status of the user in the resource index. This can be done by adding the following to the fields
method of the resource:
/** * Get the fields displayed by the resource. * * @param \Laravel\Nova\Http\Requests\NovaRequest $request * @return array */ public function fields(NovaRequest $request) { return [ // Other fields... Boolean::make('Activated') ->sortable() ->rules('required', 'boolean'), // More other fields... ]; }
Testing
composer test
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
License
The MIT License (MIT). Please see License File for more information.