Jun 4, 2017
0
Level 1
Laravel Eloquent conditional relations and Entrust Roles mapping?
I'm able to map relation like this with a Role column in users table:
public function members(){
return $this->hasMany('App\User')->whereRole('member');
}
But for multiple roles for single user I want to do it something like this with Entrust:
public function members(){
return $this->hasMany('App\User')->joinWith('role_users')->whereRole('member');
}
I'm working on a complex system. I really need this done is there a way to map the multiple roles with users with conditional relations.
Please or to participate in this conversation.