I need to select users having all given roles. In Model_User i have:
public function getUsers() {
$users = $this
->join('roles_users')->on('roles_users.user_id', '=', 'user.id')
->where('role_id', '=', ORM::factory('Role', array('name' => 'login')))
->and_where('role_id', '=', ORM::factory('Role', array('name' => 'simple_user')));
return $users;
}
But this is not working. Regards.