I got a many to many user and role structure
users
id
name
roles
id
name
role_user
user_id
role_id
Model
User.php
public function roles() {
return $this->belongsToMany('Role');
}
Role.php
public function users() {
return $this->belongsToMany('User');
}
There are two data admins
and members
in roles table, I would like to know to to filter users which role is admins.