/** * 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; }
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')); }