How to use CreateAction for a resource in an unrelated resources table headerActions?

I have recently experimented with adding a CreateAction to a resource tables headerActions, but this fails as I get the error:
Method Filament\Actions\CreateAction::table does not exist.
Method Filament\Actions\CreateAction::table does not exist.
But I was able to add my CreateAction to the ListResource pages getHeaderActions() method, like so:
protected function getHeaderActions(): array
{
return [
CreateAction::make('userOrder')
->label('Create User Order')
->model(UserOrder::class)
->form(UserOrderResource::getFormSchema()),
];
}
protected function getHeaderActions(): array
{
return [
CreateAction::make('userOrder')
->label('Create User Order')
->model(UserOrder::class)
->form(UserOrderResource::getFormSchema()),
];
}
Would it be possible to add the functionality of this action to the tables headerActions instead of List page header actions? The main reason for me wanting to move the the table header, is for the placement in the UI, to avoid having the action buttons spread out too much.
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server