/** * Returns all users who belong to * a group. * * @param \Cartalyst\Sentry\Groups\GroupInterface $group * @return array */ public function findAllInGroup(GroupInterface $group) { return $group->users()->get(); }
/** * See if the user is in the given group. * * @param \Cartalyst\Sentry\Groups\GroupInterface $group * @return bool */ public function inGroup(GroupInterface $group) { foreach ($this->getGroups() as $_group) { if ($_group->getId() == $group->getId()) { return true; } } return false; }
/** * Removes the user from the given group. * * @param \Cartalyst\Sentry\Groups\GroupInterface $group * * @return bool */ public function removeGroup(GroupInterface $group) { RevisionRepository::create(['revisionable_type' => get_class($this), 'revisionable_id' => $this->getKey(), 'key' => 'removed_group', 'old_value' => null, 'new_value' => $group->getName(), 'user_id' => Credentials::getUser()->id]); return parent::removeGroup($group); }