Livewire custom actions

Hi, I have a custom page based on the kanban plugin of Mokosh. I am trying to add quick actions to the cards of the kanban board and would like to use the default filament actions. The problem is that I have one action per card working, but when I try to add the second one it does not register the action. I have posted the code for the actions below. Is there some restriction or am I doing something wrong? Help would be appreciated!
<div class="hidden group-hover:flex group-hover:w-5 group-hover:h-5 mt-5 cursor-pointer z-10">
{{$this->orderToInvoiceAction}}
</div>
<div
class=" hidden group-hover:flex group-hover:w-5 group-hover:h-5 mt-5 z-10 cursor-pointer
">
{{($this->archiveAction)(['order' => $record->id])}}
</div>
<div class="hidden group-hover:flex group-hover:w-5 group-hover:h-5 mt-5 cursor-pointer z-10">
{{$this->orderToInvoiceAction}}
</div>
<div
class=" hidden group-hover:flex group-hover:w-5 group-hover:h-5 mt-5 z-10 cursor-pointer
">
{{($this->archiveAction)(['order' => $record->id])}}
</div>
Solution:
Okay found it! Your action name should be the same as the function you are writing. So for my function orderToInvoiceAction i needed the make() method to be 'orderToInvoice'.......
Jump to solution
2 Replies
gladjanus43
gladjanus435mo ago
This is how I implemented the actions in the livewire component. But as you can see in the video it does not dd any value when clicked. But it is rendered. The tooltip is shown and the icon applied...
public function archiveAction(): Action
{
return Action::make('Archive')
->icon('heroicon-o-archive-box')
->iconButton()
->requiresConfirmation()
->action(function (array $arguments, $action) {
$order = Order::findOrFail($arguments['order']);
if ($order->type === 'job' && $order->status === OrderStatus::FINISHED) {
$order->update([
'status' => OrderStatus::ARCHIVED
]);
}
})
->tooltip('Archiveer order');
}

public function orderToInvoiceAction(): Action
{
return Action::make('Generate Invoice')
->icon('heroicon-o-currency-euro')
->iconButton()
->requiresConfirmation()
->action(function (array $arguments, $action) {
dd('Generate Invoice');
// $order = Order::findOrFail($arguments['order']);
// Pricing::generateInvoice($order);
})
->tooltip('Genereer invoice');
}
public function archiveAction(): Action
{
return Action::make('Archive')
->icon('heroicon-o-archive-box')
->iconButton()
->requiresConfirmation()
->action(function (array $arguments, $action) {
$order = Order::findOrFail($arguments['order']);
if ($order->type === 'job' && $order->status === OrderStatus::FINISHED) {
$order->update([
'status' => OrderStatus::ARCHIVED
]);
}
})
->tooltip('Archiveer order');
}

public function orderToInvoiceAction(): Action
{
return Action::make('Generate Invoice')
->icon('heroicon-o-currency-euro')
->iconButton()
->requiresConfirmation()
->action(function (array $arguments, $action) {
dd('Generate Invoice');
// $order = Order::findOrFail($arguments['order']);
// Pricing::generateInvoice($order);
})
->tooltip('Genereer invoice');
}
Solution
gladjanus43
gladjanus435mo ago
Okay found it! Your action name should be the same as the function you are writing. So for my function orderToInvoiceAction i needed the make() method to be 'orderToInvoice'....