Entrust - get all users where the role

I have a role where the user must be "approved" first before accessing certain parts of the site. The role identifier for "unauthorized" is 5, approved 2.

In my admin view, I want all users that have role id = 5 to be able to remove / approve, etc.

Currently, my admin controller is:

public function getUnApproved() { $role = Role::find(5)->user()->get(); $this->layout->content = View::make('admin.manage.approve', array('role' => $role)); } 

Error message:

BadMethodCallException Method call undefined Lighten \ Database \ Query \ Builder :: user ()

Entrust is configured correctly using the Role model, Permission. My user model is "HasRole" as well.

Any help would be greatly appreciated.

+6
source share
1 answer

By making a multiple "user", this solved my problem.

 $role = Role::find(5)->users()->get(); 
+14
source

All Articles