/** * Show the application dashboard to the user. * * @return Response */ public function index() { $groups = []; /** @var Group $group */ foreach (Group::all() as $group) { if ($group->isOwner($this->user->id)) { $groups[] = $group; } } return view('home', ['name' => $this->user->char_name, 'avatar' => $this->user->getAvatarUrl(), 'email' => $this->user->email, 'slackName' => $this->user->slack_name, 'status' => $this->user->status, 'corp' => $this->user->corp_name, 'alliance' => $this->user->alliance_name, 'charId' => $this->user->char_id, 'groups' => $groups]); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $groups = Group::all(); foreach ($groups as $group) { $ownerNames = []; $owners = $group->getOwners(); foreach ($owners as $owner) { /** @var User $user */ $user = User::find($owner); if ($user != null) { $ownerNames[] = $user->char_name; } else { $group->removeOwner($owner); } } $group->owners = implode(', ', $ownerNames); } return view('admin.groups.index', compact('groups')); }