public function getIndex() { // List all users $users = User::all(); $title = 'All Users'; return view('admin.users.index', compact('users', 'title')); }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { /** @var Group $group */ $group = Group::find($id); if ($group == null) { abort(404); } $otherUsers = User::all(); $menuUsers = []; foreach ($group->users as $user) { $otherUsers = $otherUsers->except($user->id); } foreach ($otherUsers as $user) { $menuUsers[$user->id] = $user->char_name; } $otherChannels = Channel::all(); $menuChannels = []; foreach ($group->channels as $channel) { $otherChannels = $otherChannels->except($channel->id); } foreach ($otherChannels as $channel) { $menuChannels[$channel->id] = $channel->name; } $notOwners = User::all(); $menuOwners = []; $owners = []; foreach ($group->getOwners() as $ownerId) { if ($owner = User::find($ownerId)) { $owners[] = $owner; $notOwners = $notOwners->except($ownerId); } else { $group->removeOwner($ownerId); } } foreach ($notOwners as $owner) { $menuOwners[$owner->id] = $owner->char_name; } return view('admin.groups.show', ['id' => $group->id, 'name' => $group->name, 'channels' => $group->channels, 'users' => $group->users, 'menuUsers' => $menuUsers, 'menuChannels' => $menuChannels, 'admin' => \Auth::user()->admin, 'owners' => $owners, 'menuOwners' => $menuOwners]); }
/** * Resets all statuses, based on standings, without doing API check first. can be triggered after updating * standings to force a refresh. */ public function readNewStandings() { $users = User::all(); foreach ($users as $user) { $user->updateStatus(); $user->save(); } }
/** * @param int $limit * * @return array */ public static function listNeedUpdateIds($limit) { $allUsers = User::all(); $users = []; foreach ($allUsers as $user) { if ($user->needsUpdate()) { $users[] = $user->char_id; if (count($users) >= $limit) { return $users; } } } return $users; }