Load data on mount and use to populate select field options
I have an external API that I fetch some options from for a select menu. I would normally do this in the mount method of a livewire component so the data is only loaded once and available when the page renders. I'm trying to accomplish the same thing in filament using resource classes.
I was thinking I could use the
mutateFormDataBeforeFill
method of the CreateRecord class, and maybe populate an array property, but then how do I access that from my main Resource class where the form is? Or am I going about this all wrong?5 Replies
you can still define a mount method..
ok, but if I populate an array in the CreateRecord class, can I use it in the Resource class?
if you make it publicly available, sure
Solution
can make a
CreateRecord::getData()
ok that worked, thanks!