CheckboxList for pivot table values loading state from DB.

I have this CheckboxList field:
CheckboxList::make('contact_type')
->options([
'is_A' => 'A Value',
'is_B' => 'B Value',
'is_C' => 'C Value',
'is_D' => 'D Value',
])
//trying the below without success.
->relationship('locations')
->pivotData([
'is_a' => true,
])

CheckboxList::make('contact_type')
->options([
'is_A' => 'A Value',
'is_B' => 'B Value',
'is_C' => 'C Value',
'is_D' => 'D Value',
])
//trying the below without success.
->relationship('locations')
->pivotData([
'is_a' => true,
])

When the modal loads I want the options to be checked that correspond with the database field values from the pivot table. This is for a user who has many locations (user_locations table, locations relationship). How can I accomplish this?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server