Reuse a Form Resource in createOptionForm
Hi, sorry if this is a bit obvious.
When creating a select from relationship and allowing the option to create an option. How can i reuse an exsiting form resource ?
Forms\Components\Select::make('artwork_id')
->relationship(
name: 'artwork',
titleAttribute: 'name',
modifyQueryUsing: fn (Builder $query) => $query->where('organisation_id', $organisationId),
)
->searchable(['name', 'original_name'])
->createOptionForm(
// ArtworkResource::form()
),
Forms\Components\Select::make('artwork_id')
->relationship(
name: 'artwork',
titleAttribute: 'name',
modifyQueryUsing: fn (Builder $query) => $query->where('organisation_id', $organisationId),
)
->searchable(['name', 'original_name'])
->createOptionForm(
// ArtworkResource::form()
),
1 Reply
Like this no ?
Forms\Components\Select::make('artwork_id')
->relationship(
name: 'artwork',
titleAttribute: 'name',
modifyQueryUsing: fn (Builder $query) => $query->where('organisation_id', $organisationId),
)
->searchable(['name', 'original_name'])
->createOptionForm(
fn(Form $form) => ArtworkResource::form($form)
),
Forms\Components\Select::make('artwork_id')
->relationship(
name: 'artwork',
titleAttribute: 'name',
modifyQueryUsing: fn (Builder $query) => $query->where('organisation_id', $organisationId),
)
->searchable(['name', 'original_name'])
->createOptionForm(
fn(Form $form) => ArtworkResource::form($form)
),