Can I pass in a filament resource's form into createOptionsForm()?
For example we have
Post
belongsToMany Tag
and I want to be able to create new tags on-the-fly when selecting tags for a Post.
3 Replies
Solution
You absolutely can do it!
Forms\Components\Select::make('region_id')
->relationship('region', 'name')
->label('Region')
->required()
->createOptionForm(fn(Form $form) => RegionResource::form($form))
->searchable()->preload(),
Formatting on mobile sucks sorry!
Yes, that did the trick! Nice and easy. Thank you. Here's the updated code: