{"id":15046183,"url":"https://github.com/dcasia/nova-detached-actions","last_synced_at":"2025-10-01T10:31:48.577Z","repository":{"id":56968728,"uuid":"262565514","full_name":"dcasia/nova-detached-actions","owner":"dcasia","description":"A Laravel Nova tool to allow for placing actions in the Nova toolbar detached from the checkbox selection mechanism.","archived":false,"fork":true,"pushed_at":"2020-05-09T16:51:06.000Z","size":604,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-30T22:13:04.178Z","etag":null,"topics":["actions","button","laravel","nova"],"latest_commit_sha":null,"homepage":null,"language":"Vue","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"gobrightspot/nova-detached-actions","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dcasia.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-09T12:25:24.000Z","updated_at":"2020-11-25T05:04:05.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/dcasia/nova-detached-actions","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcasia%2Fnova-detached-actions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcasia%2Fnova-detached-actions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcasia%2Fnova-detached-actions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcasia%2Fnova-detached-actions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dcasia","download_url":"https://codeload.github.com/dcasia/nova-detached-actions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234858944,"owners_count":18897843,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actions","button","laravel","nova"],"created_at":"2024-09-24T20:52:49.265Z","updated_at":"2025-10-01T10:31:48.259Z","avatar_url":"https://github.com/dcasia.png","language":"Vue","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel Nova Detached Actions Tool\n\nA Laravel Nova tool to allow for placing actions in the Nova toolbar, detached from the checkbox selection mechanism.\n\n: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.\n\n\n![screenshot](https://i.imgur.com/S8GrNFI.png)\n\n## Installation\n\nYou can install the package in to a Laravel app that uses [Nova](https://nova.laravel.com) via composer:\n\n```bash\ncomposer require digital-creative/nova-detached-actions\n```\n\n## Usage\n\nCreate a custom Nova Action file:\n\n```bash\nphp artisan nova:action ExportUsers\n```\n\nInstead of extending the `ExportUsers` class with the `Laravel\\Nova\\Actions\\Action` class, swap it with the `DigitalCreative\\DetachedActions\\DetachedAction` class.\n\nSince 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)`.\n\nYou 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`.\n\nHere's a full example:\n\n```php\n\u003c?php\n\nnamespace App\\Nova\\Actions;\n\nuse DigitalCreative\\DetachedActions\\DetachedAction;\nuse Illuminate\\Bus\\Queueable;\nuse Illuminate\\Queue\\SerializesModels;\nuse Illuminate\\Queue\\InteractsWithQueue;\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\nuse Laravel\\Nova\\Fields\\ActionFields;\n\nclass ExportUsers extends DetachedAction\n{\n    use InteractsWithQueue, Queueable, SerializesModels;\n    \n    /**\n     * Get the displayable label of the button.\n     *\n     * @return string\n     */\n    public function label()\n    {\n        return __('Export Users');\n    }\n\n    /**\n     * Perform the action.\n     *\n     * @param  ActionFields  $fields\n     *\n     * @return mixed\n     */\n    public function handle(ActionFields $fields)\n    {\n        // Do work to export records\n\n        return DetachedAction::message('It worked!');\n    }\n\n    /**\n     * Get the fields available on the action.\n     *\n     * @return array\n     */\n    public function fields()\n    {\n        return [];\n    }\n}\n```\n\nRegister the action on your resource:\n\n```php\n...\n    /**\n     * Get the actions available for the resource.\n     *\n     * @param  \\Illuminate\\Http\\Request  $request\n     * @return array\n     */\n    public function actions(Request $request)\n    {\n        return [\n            new App\\Nova\\Actions\\ExportUsers\n        ];\n    }\n...\n```\n\n### Usage with the Laravel Nova Excel `DownloadExcel` action\n\nYou can easily integrate the `DetachedAction` tool with the [Laravel Nova Excel](https://github.com/Maatwebsite/Laravel-Nova-Excel) `DownloadExcel` action by simply passing some additional data along using `withMeta()`.\n\n```php\n...\n    /**\n      * Get the actions available for the resource.\n      *\n      * @param  \\Illuminate\\Http\\Request  $request\n      * @return array\n      */\n     public function actions(Request $request)\n     {\n         return [\n             (new DownloadExcel)-\u003ewithHeadings()-\u003easkForWriterType()-\u003ewithMeta([\n                 'detachedAction' =\u003e true,\n                 'label' =\u003e 'Export'\n             ])-\u003econfirmButtonText('Export'),\n         ];\n     }\n ...\n ```\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE) for more information.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcasia%2Fnova-detached-actions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdcasia%2Fnova-detached-actions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcasia%2Fnova-detached-actions/lists"}