I have a multiselect form to store multiple client_id in contact table:
{!! Form::select('client_id[]', $clients, null, ['multiple'=>true]) !!}
When I show an individual client, I wish to show the related contacts.
My client Model has as a 1:many relationship defined as:
public function contact()
{
return $this->hasMany('App\Models\contact');
}
usually, for non array items, I would use:
$contacts = $client->contact()->get();
to fetch related contacts, but as the client_id is stored as an array in my contact table, how to I fetch this data?