F
Filamentβ€’4w ago
Tony

Open Modal with parameters

Hello community πŸ‘‹ do you know how to pass parameters to modal with livewire dispatch? I need to pass $payment to my paypal modal:
class Subscription extends Page implements HasActions
{
use InteractsWithActions;

#[On('payment-created')]
public function paymentCreated(int $paymentId): void
{
$payment = auth()->user()
->payments()
->find($paymentId);

$this->dispatch(
'open-modal',
id: 'paypal-checkout',
payment: $payment
);
}
class Subscription extends Page implements HasActions
{
use InteractsWithActions;

#[On('payment-created')]
public function paymentCreated(int $paymentId): void
{
$payment = auth()->user()
->payments()
->find($paymentId);

$this->dispatch(
'open-modal',
id: 'paypal-checkout',
payment: $payment
);
}
<x-filament::modal id="paypal-checkout">
<livewire:paypal-checkout :payment="$payment"/>
</x-filament::modal>
<x-filament::modal id="paypal-checkout">
<livewire:paypal-checkout :payment="$payment"/>
</x-filament::modal>
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?