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:Jump to solution
I added this to the List:
Actions\Action::make('download')
->label(__('Download Plugin'))
->icon('heroicon-o-arrow-down-tray')...
10 Replies
Hi Markwowz
Hi Lionking
same problem
It seems like you are trying to add a link next to the "New" button on a recourse page. If you wan
that is correct
I figured it out
Solution
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";
}),
and boom got a button
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 knowThanks lion king that did work for me
so is everything okay?