Pass data from custom view back to action

Hi! I have a custom action on a list page that renders a blade view, however, I cannot seem to figure out how to pass data from the modal to the action callback. Any ideas? The action:
Actions\Action::make('Purchase additional domains')
->icon('heroicon-o-currency-dollar')
->modalContent(fn () => view('filament.app.components.billing.additional-domains'))
->action(function ($data) {
dd($data);
})
->outlined()
->hidden(fn() => !Auth::user()->isSubscribed())
Actions\Action::make('Purchase additional domains')
->icon('heroicon-o-currency-dollar')
->modalContent(fn () => view('filament.app.components.billing.additional-domains'))
->action(function ($data) {
dd($data);
})
->outlined()
->hidden(fn() => !Auth::user()->isSubscribed())
Blade view:
<div x-data="{ domainCount: 1, isYearly: false }">
<p>
Select the number of additional domains you'd like to purchase. Each additional domain costs &euro;10.00 / <span x-text="isYearly ? 'year' : 'month'"></span>
</p>
<div class="mt-8 mb-8">
<input type="range" min="1" max="10" value="1" class="range" step="1" x-model="domainCount" />
<div class="flex w-full justify-between px-2 text-xs mt-2">
<template x-for="i in 10">
<span x-text="i"></span>
</template>
</div>
</div>

Your total is &euro;<span x-text="domainCount * (isYearly ? 100 : 10)"></span> / <span x-text="isYearly ? 'year' : 'month'"></span>.
This will get billed additionally to your existing subscription.
</div>
<div x-data="{ domainCount: 1, isYearly: false }">
<p>
Select the number of additional domains you'd like to purchase. Each additional domain costs &euro;10.00 / <span x-text="isYearly ? 'year' : 'month'"></span>
</p>
<div class="mt-8 mb-8">
<input type="range" min="1" max="10" value="1" class="range" step="1" x-model="domainCount" />
<div class="flex w-full justify-between px-2 text-xs mt-2">
<template x-for="i in 10">
<span x-text="i"></span>
</template>
</div>
</div>

Your total is &euro;<span x-text="domainCount * (isYearly ? 100 : 10)"></span> / <span x-text="isYearly ? 'year' : 'month'"></span>.
This will get billed additionally to your existing subscription.
</div>
1 Reply
toeknee
toeknee2w ago
I would probably say a view isn't what you want and you likely want to render a livewire component or use a custom field, then you can ensure that field's values are set as standard livewire? You could try teleporting... but not too sure how that will work https://livewire.laravel.com/docs/teleport
Laravel
Teleport | Laravel
A full-stack framework for Laravel that takes the pain out of building dynamic UIs.

Did you find this page helpful?