F
Filamentβ€’3mo ago
sdssd

load and store state in custom field

Hello I made a custom field for area selection in map Like this AREASelection::make() For create forms i dont have any problem with setting default value But for edit -> default will not run My question is How can i pass state to a custom field before loading component ? In version two we have loadStateUsing But this is not available in version 3! How else should we pass record relation data to custom field in edit form Thanks
2 Replies
LeandroFerreira
LeandroFerreiraβ€’3mo ago
Try formatStateUsing. Default only works in the create page
sdssd
sdssdOPβ€’3mo ago
I appreciate your answer Now I have this and state sets correctly H3MapSelector::make('map')-formatStateUsing( fn(Area $r)=>$r->geocodes->pluck('code')->join(",") ) This is supposed to work like ->setRelation method in select fields Can you guide me with 1-is there anyway to write this cleaner? 2-how can i handle storing this input in relation table and not using it for main record Thanks πŸ™
Want results from more Discord servers?
Add your server