Form keep loading

I have one Form that's keep loading... finish with timeout. This form is only to view information, so is a view. I remove, all the RelationManager and on the form make simple a Select:
Select::make('contact_id')->label('Contact')
->options(function (callable $get) {

return Contact::find($get('contact_id'))->pluck('email', 'id');
}),
Select::make('contact_id')->label('Contact')
->options(function (callable $get) {

return Contact::find($get('contact_id'))->pluck('email', 'id');
}),
the others fields are from the model. I use MySQL and the table has 159736 records. I have another thable with more records and don't have any problem. How can i debug this?
7 Replies
Dan Harrin
Dan Harrin2y ago
find returns 1 record not an array of options right?
marianov24
marianov24OP2y ago
Yes, is one record
marianov24
marianov24OP2y ago
No description
Dan Harrin
Dan Harrin2y ago
but it needs to be an array
toeknee
toeknee2y ago
I think pluck would convert it to an array of a single result. Put ->toArray() on the end. I would suggest you make the select a search query version not loading all the results in the edit. Also, if it’s just a view and never edit or create just make a relationship on the model and load it in with contact.name in a TextInput and drop to the select.
marianov24
marianov24OP2y ago
I can confirm that the problem was the select. I tried the Relationship and it works. Thank you
toeknee
toeknee2y ago
Great to hear
Want results from more Discord servers?
Add your server