Cannot Add Actions To Global Search Results

https://filamentphp.com/docs/4.x/resources/global-search#adding-actions-to-global-search-results app/Filament/Resources/Songs/SongResource.php seems we cant do:
public static function getGlobalSearchResultActions(Model $record): array
{
return [
Action::make('add_to_queue')
->action(function (Song $record): void {
dd('i wanna do stuff here');
})
];
}
public static function getGlobalSearchResultActions(Model $record): array
{
return [
Action::make('add_to_queue')
->action(function (Song $record): void {
dd('i wanna do stuff here');
})
];
}
why?
Livewire \ Exceptions \ MethodNotFoundException
PHP 8.4.12
12.25.0
Unable to call component method. Public method [mountAction] not found on component
Livewire \ Exceptions \ MethodNotFoundException
PHP 8.4.12
12.25.0
Unable to call component method. Public method [mountAction] not found on component
2 Replies
ericmp
ericmpOP3w ago
hacky workaround to make it work: 1- create a livewire component 2- add it on the admin panel provider - renderHook 3- use ->dispatch('addToQueue', [$record->id]) 4- listen the event on that lw component done but omg feels so hacky please, if someone knows, explain me a workaround cuz im finding more issues this way im following is not appropiate xd
Dennis Koch
Dennis Koch3w ago
They can open a URL or dispatch a Livewire event.
->action() is not supported for global search actions.

Did you find this page helpful?