1 month ago

Easiest way to query based on a relationship

Posted 1 month ago by illmatic

I have a Role Model that has names such as "admin". Each User has a number of roles

public function roles()
    return $this->belongsToMany('App\Role')->withTimestamps();

How can I easily return all the Users who have Admin as a role?

Please sign in or create an account to participate in this conversation.