{"id":13564975,"url":"https://github.com/gobrightspot/nova-detached-actions","last_synced_at":"2026-01-14T00:49:16.300Z","repository":{"id":39131809,"uuid":"262406015","full_name":"gobrightspot/nova-detached-actions","owner":"gobrightspot","description":"A Laravel Nova tool to allow for placing actions in the Nova toolbar detached from the checkbox selection mechanism.","archived":true,"fork":false,"pushed_at":"2023-04-20T22:33:04.000Z","size":1514,"stargazers_count":168,"open_issues_count":20,"forks_count":59,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-11-09T01:09:00.253Z","etag":null,"topics":["laravel","laravel-nova","laravel-nova-tool","php","vuejs"],"latest_commit_sha":null,"homepage":null,"language":"Vue","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gobrightspot.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-05-08T19:02:21.000Z","updated_at":"2025-09-22T16:49:15.000Z","dependencies_parsed_at":"2024-01-14T03:49:14.440Z","dependency_job_id":"4a2f2f8a-d478-430a-832b-1332e043b8f1","html_url":"https://github.com/gobrightspot/nova-detached-actions","commit_stats":{"total_commits":56,"total_committers":17,"mean_commits":"3.2941176470588234","dds":0.6428571428571428,"last_synced_commit":"9710b19cb9b1e5759483e01bf1d57f5cb2060459"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/gobrightspot/nova-detached-actions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gobrightspot%2Fnova-detached-actions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gobrightspot%2Fnova-detached-actions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gobrightspot%2Fnova-detached-actions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gobrightspot%2Fnova-detached-actions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gobrightspot","download_url":"https://codeload.github.com/gobrightspot/nova-detached-actions/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gobrightspot%2Fnova-detached-actions/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28406883,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T00:40:43.272Z","status":"ssl_error","status_checked_at":"2026-01-14T00:40:42.636Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["laravel","laravel-nova","laravel-nova-tool","php","vuejs"],"created_at":"2024-08-01T13:01:38.753Z","updated_at":"2026-01-14T00:49:16.281Z","avatar_url":"https://github.com/gobrightspot.png","language":"Vue","funding_links":[],"categories":["Vue"],"sub_categories":[],"readme":"# Laravel Nova Detached Actions Tool\n\n![Status: ABANDONED](https://img.shields.io/badge/Status-ABANDONED-red.svg?style=flat)\n[![No Maintenance Intended](http://unmaintained.tech/badge.svg)](http://unmaintained.tech/) \n\n## Deprecation Notice :warning:\n\n\u003e GoBrightspot is no longer maintaining this project. Please fork it to continue development.\n\n## Intro\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:warning: Also, keep in mind, pivot actions are not supported and have not been tested.\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 gobrightspot/nova-detached-actions\n```\n\nThe tool will be automatically registered via the `ToolServiceProvider`\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 `Brightspot\\Nova\\Tools\\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\nBy default, the detached action will only appear on the Index Toolbar.\n\nIf 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;`\nIf 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;`\n\nHere's a full example:\n\n```php\n\u003c?php\n\nnamespace App\\Nova\\Actions;\n\nuse Brightspot\\Nova\\Tools\\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 * Get the actions available for the resource.\n *\n * @param  \\Illuminate\\Http\\Request  $request\n * @return array\n */\npublic function actions(Request $request)\n{\n    return [\n        new App\\Nova\\Actions\\ExportUsers\n    ];\n}\n```\n\n## Chunking and repetitive calls to the handle()\nIf you initiate an action on the background Nova will chunk up the total amount of records and call the `handle()` function of your DetachedAction for each chunk. This could have unexpected performance impact as the system will perform your action for each chunk of records.\nThis happens in the `handleRequest()` function of `\\Laravel\\Nova\\Actions\\Action.php`.\n\nTo prevent this the simplest way is to overrule this function in your `DetachedAction`. this is a bare example dispatching just a job without any checks or other logic:\n\n```php\n/** @return array\u003cint,string\u003e */\npublic function handleRequest(ActionRequest $request): array\n{\n    dispatch(new GenerateTicketReport($request-\u003eresolveFields()));\n    return DetachedAction::message('Nice job!');\n}\n```\n\n### Display on different screens\n\n##### `showOnIndexToolbar()`\nShow the detached action buttons on the index page toolbar (i.e. the default location). Do not show on the index grid action dropdown, \n\n##### `onlyOnIndexToolbar()`\nOnly show the detached action buttons on the index toolbar. Do not show them anywhere else.\n\n##### `exceptOnIndexToolbar`\nShow the detached action buttons everywhere except the index toolbar.\n\n##### `onlyOnIndex`\nShow the detached action buttons only on the index view. Allows them to be displayed on the `standalone` dropdown or in the grid action dropdown.\n\n##### `showOnDetailToolbar()`\nShow the detached action buttons on the detail page toolbar (i.e. the default location).\n\n##### `onlyOnDetailToolbar()`\nOnly show the detached action buttons on the index toolbar. Do not show them anywhere else.\n\n##### `exceptOnDetailToolbar`\nShow the detached action buttons everywhere except the detail toolbar.\n\n##### `onlyOnDetail`\nShow the detached action buttons only on the detail view. Allows them to be displayed on the `standalone` dropdown or in the action dropdown.\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  * 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             'name' =\u003e 'Export',\n             'showOnIndexToolbar' =\u003e true\n         ])-\u003econfirmButtonText('Export'),\n     ];\n }\n ```\n\n### Customizing Buttons\n\n### Visible vs Invisible Buttons\n\nBy default, the component will show the first 3 buttons and put the rest into a dropdown menu. If you want to change the number of buttons visible per resource, you can do so by using the `additionalInformation` method, like so:\n\n```php\npublic static function additionalInformation(Request $request)\n{\n    return [\n        'visibleActionsLimit' =\u003e 4\n    ];\n}\n```\n\nYou can also change the icon type and whether or not you want to display a dropdown arrow for the invisible action menu:\n\n```php\npublic static function additionalInformation(Request $request)\n{\n    return [\n        'visibleActionsLimit' =\u003e 2,\n        'showInvisibleActionsArrow' =\u003e true,\n        'invisibleActionsIcon' =\u003e 'menu'\n    ];\n}\n```\n\n\n### Customizing Button Classes\n\nThe package ships with some common sense default HTML classes that are applied to the action buttons. In the component, we automatically assign the following:\n\n```\nbtn btn-default ml-3 detached-action-button flex justify-center items-center\n```\n\nThe action buttons are buttons so it makes sense to assign the `btn` and `btn-default` classes, we also want consistent spacing between buttons, so we apply `ml-3` and to line up the icons and text inside the button, we use `flex justify-center items-center`. Further, in order to allow theme developers to set a specific class name to hook into, we apply `detached-action-button` on both the Index and Detail views.\n\nOn top of these classes, the `DetachedAction` class provides `btn-primary` as a default, that will give the buttons the default button color, i.e. blue in the default Nova theme.\n\nA developer can add classes on the fly, using the `extraClassesWithDefault()` and `extraClasses()` methods on the `DetachedAction` class.\n\n### The `extraClassesWithDefault()` method\n\n If you want to keep the default classes but add extra classes alongside them, then you probably want to use this method. You can pass an array of single class names or multiple class names separated by spaces.\n\n```php\nreturn [\n    (new ImportUsers)-\u003eextraClassesWithDefault('bg-info')\n];\n```\n\n### The `extraClasses()` method\n\nYou are free to use any tailwind/nova class.\n\n```php\nreturn [\n   (new ImportUsers)-\u003eextraClasses('bg-logo text-white hover:black')\n];\n```\n\n### Adding an icon\n\nYou can use any of the 104 Heroicon icons by specifying the icon name in lowercase:\n\n```php\nreturn [\n   (new ImportUsers)-\u003eicon('add')\n];\n```\n\nYou can also customize the display of that icon using `iconClasses`:\n\n```php\nreturn [\n   (new ImportUsers)-\u003eicon('upload')-\u003eiconClasses('mr-3 -ml-2')\n];\n```\n\n\n![screenshot](https://i.imgur.com/9PaOxZC.png)\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%2Fgobrightspot%2Fnova-detached-actions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgobrightspot%2Fnova-detached-actions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgobrightspot%2Fnova-detached-actions/lists"}