F
Filamentβ€’4mo ago
MZX

Modify create button to do more than create

Am I doing this right? I want to create the record, but also go to the checkout page.
protected function getCreateFormAction(): Action
{
return Action::make('pay')
->label('Pay')
->submit('create')
->action(function ($record) {
$amount = $record->amount;
return redirect()->route('create.checkout.session', ['amount' => $amount]);
})
->color('success');
}
protected function getCreateFormAction(): Action
{
return Action::make('pay')
->label('Pay')
->submit('create')
->action(function ($record) {
$amount = $record->amount;
return redirect()->route('create.checkout.session', ['amount' => $amount]);
})
->color('success');
}
4 Replies
dissto
disstoβ€’4mo ago
You could probably use the already existing successRedirectUrl πŸ€”
MZX
MZXβ€’4mo ago
Oh yeah, smart protected function getRedirectUrl(): string {
return redirect()->route('create.checkout.session', ['amount' => $amount]); } how do i reference the amount though? i tried $amount = $this->amount but it didn't work
dissto
disstoβ€’4mo ago
$this->record or $this->data i assume πŸ€”
MZX
MZXβ€’4mo ago
$this->record->amount
Want results from more Discord servers?
Add your server