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?
Solution:
can make a CreateRecord::getData()
Jump to solution
5 Replies
Jordy
Jordy14mo ago
you can still define a mount method..
Jon Mason
Jon MasonOP14mo ago
ok, but if I populate an array in the CreateRecord class, can I use it in the Resource class?
Jordy
Jordy14mo ago
if you make it publicly available, sure
Solution
Jordy
Jordy14mo ago
can make a CreateRecord::getData()
Jon Mason
Jon MasonOP14mo ago
ok that worked, thanks!
Want results from more Discord servers?
Add your server