Set MorphToSelect to a value in mount()

What on earth is a good way to pre-set the Morph-type to a default value when using a form?
2 Replies
The Milkman
The MilkmanOP2y ago
Oh haha, the moment I posted this, I found a solution 😉
$this->form->fill([
'recipient_type' => User::class,
]);
$this->form->fill([
'recipient_type' => User::class,
]);
Or, if you are using Morphmaps, use something like this:
'recipient_type' => User::make()->getMorphClass()
'recipient_type' => User::make()->getMorphClass()
onlytiebowline
onlytiebowline16mo ago
@The Milkman I am trying to solve the same problem. Where exactly did you place the $this->form->fill() ?

Did you find this page helpful?