/** * Show a team * * @param int $id The id of the team * @return void */ public function show($id) { $team = Team::published()->findOrFail($id); $team->access_counter++; $team->save(); $this->title($team->title); $this->pageView('teams::show', compact('team')); }
/** * Returns the lineup of a team * * @param int $id ID of the opponent * @return string */ public function lineup($id) { $team = Team::findOrFail($id); $lineup = ''; foreach ($team->members as $user) { if ($lineup) { $lineup .= ', '; } $lineup .= $user->username; } return $lineup; }
/** * Return form for joining a team * * @param int $userId * @return Response */ public function getAdd($userId) { $ids = DB::table('team_user')->whereUserId($userId)->lists('team_id'); if (sizeof($ids) > 0) { $teams = Team::whereNotIn('id', $ids)->get(); } else { $teams = Team::all(); } if (sizeof($teams) > 0) { return View::make('teams::admin_members_team', compact('teams', 'user')); } else { return Response::make(''); } }
public function store() { $msg = new JoinMessage(Input::all()); $msg->ip = getenv('REMOTE_ADDR'); $okay = $msg->isValid(); if ($okay) { $team = Team::findOrFail(Input::get('team_id')); $msg = new ContactMessage(Input::all()); $msg->title = 'Application of ' . $msg->username; $msg->text = '<strong>Team:</strong> ' . $team->title . '<br><br>' . '<strong>' . trans('app.role') . ':</strong> ' . Input::get('role') . '<br><br>' . '<strong>' . trans('contact::application') . ':</strong> <br><br>' . $msg->text; $msg->forceSave(); $this->alertSuccess(trans('contact::message_sent')); } else { return Redirect::to('join-us')->withInput()->withErrors($msg->getErrors()); } }
/** * Show a team * * @param int $id The id of the team * @return void */ public function show($id) { $team = Team::findOrFail($id); $this->title($team->title); $this->pageView('teams::show', compact('team')); }