The modal name is Client_user, which has multiple relationship to other tables, Roles, Clients, Kds
the functions are as follows
class Client_user extends Authenticatable
{
public function roles()
{
return $this->belongsToMany(Role::class);
}
public function clients()
{
return $this->belongsToMany(Client::class);
}
public function kds()
{
return $this->belongsToMany(Kds_master::class);
}
}
For getting the relation data for eg: say kds what I usually do is
$data = Client_user::with('kds')->get();
Is there any way to get all the related data together in a single function like?
public function clientapi()
{
return $this->belongsToMany(Role::class,Client::class,Kds::class);
}
It doesn't work. My question is anything similar to this, without 3 functions