Action within form to redirect to different resource create

Having a brain block probably...but how do I get an action button component inside a:
CreateAction::make()->form(..schema_array...)
CreateAction::make()->form(..schema_array...)
I want to do something like this:
Action::make('AddNewPersona')
->icon('user-plus')
->color('primary')
->requiresConfirmation()
->url(fn () : string => route('filament.customer.resources.persona-profiles.create')),
Action::make('AddNewPersona')
->icon('user-plus')
->color('primary')
->requiresConfirmation()
->url(fn () : string => route('filament.customer.resources.persona-profiles.create')),
But, I can't put that in as a form component. Am I being limited by using the prebuilt Actions. Or something else I have yet to understand. I'm reading the documentation, and don't get me wrong, I think the platform is fantastic, but some of the repeated terminology can confuse the less able minds like mine! I take the form components from
NewApplicationForm::getForm()
NewApplicationForm::getForm()
which is returning an array. Here is my originating class:
class ListApplications extends ListRecords
{
protected static string $resource = ApplicationsResource::class;

protected static ?string $title = 'Applications';

protected function getHeaderActions() : array
{
$getApplicantName = function ($record) : string {
return $record->personaProfile->pp_person_fullname;
};

return [
CreateAction::make()
->form(NewApplicationForm::getForm())
->label('New Application')
->slideOver()
->modalHeading('Add a new Application?')
->using(function (array $data) : Model {
return ApplicantDetails::createFromCustomer($data);
}),
];
}
}
class ListApplications extends ListRecords
{
protected static string $resource = ApplicationsResource::class;

protected static ?string $title = 'Applications';

protected function getHeaderActions() : array
{
$getApplicantName = function ($record) : string {
return $record->personaProfile->pp_person_fullname;
};

return [
CreateAction::make()
->form(NewApplicationForm::getForm())
->label('New Application')
->slideOver()
->modalHeading('Add a new Application?')
->using(function (array $data) : Model {
return ApplicantDetails::createFromCustomer($data);
}),
];
}
}
Appreciate any pointers.
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server