FilamentF
Filament13mo ago
Majd

Set default MorphTo relationships in Form Builder

How for MorphTo relationships in Form Builder add default value on first step when choose MorphToSelect\Type?

I need when I press button "New record" and open create page '/admin/comments/create', already default value choose on first step (see image 1)

I need something like this:

MorphToSelect::make('commentable')
->types([
MorphToSelect\Type::make(Product::class)
->titleAttribute('name'),
MorphToSelect\Type::make(Post::class)
->titleAttribute('title'),
])
->default(Product::class)
Was this page helpful?