Beispiel #1
0
 public function show($groupName)
 {
     $group = Group::name($groupName)->with('creator')->firstOrFail();
     $group->checkAccess();
     $stats = ['contents' => intval(Content::where('group_id', $group->getKey())->count()), 'comments' => intval(Content::where('group_id', $group->getKey())->sum('comments')), 'entries' => intval(Entry::where('group_id', $group->getKey())->count()), 'banned' => intval(GroupBan::where('group_id', $group->getKey())->count()), 'subscribers' => $group->subscribers, 'moderators' => intval(GroupModerator::where('group_id', $group->getKey())->count())];
     return array_merge($group->toArray(), ['stats' => $stats]);
 }
Beispiel #2
0
 public function getInfo($user)
 {
     $stats = ['contents' => (int) $user->contents->count(), 'comments' => (int) $user->comments->count(), 'entries' => (int) $user->entries->count(), 'moderated_groups' => intval(GroupModerator::where('user_id', $user->getKey())->count())];
     return ['name' => $user->name, 'age' => $user->age, 'avatar' => $user->avatar, 'description' => $user->description, 'joined' => current($user->created_at), 'location' => $user->location, 'sex' => $user->sex, 'stats' => $stats];
 }
Beispiel #3
0
 public function showModeratorList($group)
 {
     $moderators = GroupModerator::where('group_id', $group->getKey())->orderBy('created_at', 'asc')->with('user')->paginate(25);
     return view('group.moderators', compact('group', 'moderators'));
 }