F
Filament13mo ago
Hro

Fill defaults on create with $attributes from model

Hi, Wondering if I am overlooking something. I would love to always fill the defaults in the form based on the default attributes in the model. Currently I am adding this to the mount in the create pages:
$this->form->fill($this->getModel()::make()->attributesToArray());
$this->form->fill($this->getModel()::make()->attributesToArray());
But I kinda feel this should be done already somehow?
1 Reply
awcodes
awcodes13mo ago
Why should it “be done already”? Not everyone has defaults for their attributes. What you’re doing is fine for you app because your app utilizes it.
Want results from more Discord servers?
Add your server