Pass URL parameters to a CreateResource form inputs

Hi, I'm currently building a widget to display donors who are missing a payment from their subscription on the dashboard. It's a table, and for each member I have a "Create a Payment" link. For now, the link takes the admin to the create a payment form, but I'd like to populate the form fields using URL parameters, as such: http://example.com/admin/payments/create?donorid=1&amount=50 Is there any way to do so in Filament?
5 Replies
awsqed
awsqed14mo ago
something like this in the CreatePayment class would work
protected function fillForm(): void
{
parent::fillForm();

$request = request();

$this->form->fill($request->query());
}
protected function fillForm(): void
{
parent::fillForm();

$request = request();

$this->form->fill($request->query());
}
valentin_morice
valentin_moriceOP14mo ago
Which class should the CreatePayment extends? I can't seem to find the fillForm() function and the class it belongs to.
awsqed
awsqed14mo ago
the default class when you create the resource
use Filament\Resources\Pages\CreateRecord;
use Filament\Resources\Pages\CreateRecord;
Solution
awsqed
awsqed14mo ago
No description
valentin_morice
valentin_moriceOP14mo ago
Ah yes, found it, thank you. Still a bit new to filament. Have a great day!!
Want results from more Discord servers?
Add your server