Prefill Resource Create Fields from beforeFill()?
I'm looking to prefill some resource fields (when Creating a resource) using values from a cookie. Is the beforeFill() Life Cycle hook an appropriate place to do this? If so, how do I actually interact with the $form from inside this hook?
Is there another more appropriate place to do this?
6 Replies
Digging in still, I was hoping this might work:
but I think this may only be for editing records? Is the only place to modify the initial values for a field the 'default()' method?
Yes, use
default()
Thank you Leandro.
This also just solved the other part of my issue. The fact this is a livewire component made everything else much cleaner/easier too.
Oh this is awesome! I can use $this->form->fill() in mount!
Filament is amazing. I wish there was some intro documentation in regards to tightly integrated livewire is with Filament. This tiny epiphany just opened my eyes to what filament is capable of.
You ask and you answer your question π