Example #1
0
 /**
  * Returns the groups a user is authorized to access.
  *
  * @return \Illuminate\Database\Eloquent\Relations\HasMany
  */
 public function authorized_groups()
 {
     $groupIds = GroupMember::where('user_id', '=', $this->id)->where('target_type', '=', 'Group')->lists('target_id')->toArray();
     return Group::whereIn('id', $groupIds)->get();
 }