richusx
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:
Blade view:
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())
<div x-data="{ domainCount: 1, isYearly: false }">
<p>
Select the number of additional domains you'd like to purchase. Each additional domain costs €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 €<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 €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 €<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>
2 replies