Ejemplo n.º 1
0
 public function findMemberByUserId($userId)
 {
     if (!isset($this->id) || empty($this->id)) {
         throw new \Exception("You must have a group ID set in order to search for members");
     }
     return GroupMember::where('user_id', '=', $userId)->where('group_id', '=', $this->id)->first();
 }
Ejemplo n.º 2
0
 /**
  *	getValidSponsors.
  *
  *	@todo I'm not sure what exactly this does at first glance
  */
 public function getValidSponsors()
 {
     $collection = new Collection();
     $groups = GroupMember::where('user_id', '=', $this->id)->whereIn('role', array(Group::ROLE_EDITOR, Group::ROLE_OWNER))->get();
     foreach ($groups as $groupMember) {
         $collection->add($groupMember->group()->first());
     }
     $users = UserMeta::where('user_id', '=', $this->id)->where('meta_key', '=', UserMeta::TYPE_INDEPENDENT_SPONSOR)->where('meta_value', '=', '1')->get();
     foreach ($users as $userMeta) {
         $collection->add($userMeta->user()->first());
     }
     return $collection;
 }
Ejemplo n.º 3
0
 public function getIndex()
 {
     if (!Auth::check()) {
         return Redirect::to('user/login')->with('error', 'Please log in to view groups');
     }
     $userGroups = GroupMember::where('user_id', '=', Auth::user()->id)->get();
     return View::make('groups.index', compact('userGroups'));
 }