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 Harrin16mo ago
find returns 1 record not an array of options right?
marianov24
marianov2416mo ago
Yes, is one record
marianov24
marianov2416mo ago
No description
Dan Harrin
Dan Harrin16mo ago
but it needs to be an array
toeknee
toeknee16mo 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
marianov2416mo ago
I can confirm that the problem was the select. I tried the Relationship and it works. Thank you
toeknee
toeknee16mo ago
Great to hear