Adding Header Action to a resource

I see the option to add it on resource pages, but I just want it to appear on top next to the "New whatever" button. I tried getHeaderActions() on my WhateverResource.php and it doesnt seem to add the link.
Solution:
I added this to the List: Actions\Action::make('download') ->label(__('Download Plugin')) ->icon('heroicon-o-arrow-down-tray')...
Jump to solution
10 Replies
Lionking-Dev
Lionking-Dev15mo ago
Hi Markwowz
Markwowz
MarkwowzOP15mo ago
Hi Lionking
Askancy
Askancy15mo ago
same problem
Lionking-Dev
Lionking-Dev15mo ago
It seems like you are trying to add a link next to the "New" button on a recourse page. If you wan
Markwowz
MarkwowzOP15mo ago
that is correct I figured it out
Solution
Markwowz
Markwowz15mo ago
I added this to the List: Actions\Action::make('download') ->label(__('Download Plugin')) ->icon('heroicon-o-arrow-down-tray') ->url(function () { return "/plugins/seed-manager.zip"; }),
Markwowz
MarkwowzOP15mo ago
and boom got a button
Lionking-Dev
Lionking-Dev15mo ago
To add a link next to the "New whatever" button on the top of the resource pages in Laravel Nova, you can modify the resource's fields method in the WhateverResource.php file. Set the label, icon, and URL for the action. In your case, it should be something like: Actions\Action::make('download') ->label(__('Download Plugin')) ->icon('heroicon-o-arrow-down-tray') ->url('/plugins/seed-manager.zip') Add the above action to the fields array. It should look like this: public function fields(Request $request) { return [ // Other fields and actions... Actions\Action::make('download') ->label(__('Download Plugin')) ->icon('heroicon-o-arrow-down-tray') ->url('/plugins/seed-manager.zip'), ]; } plz check and let me know
Markwowz
MarkwowzOP15mo ago
Thanks lion king that did work for me
Lionking-Dev
Lionking-Dev15mo ago
so is everything okay?
Want results from more Discord servers?
Add your server