public function postEditTeam(LoggedInRequest $request, $teamID) { // $teamKey = $request->input('teamKey'); $team = Team::findOrFail($teamID); $team->name = $request->input('teamName'); $team->abb = strtoupper($request->input('teamAbb')); if ($request->input('delete') == "delete") { $games = Game::all(); foreach ($games as $game) { if ($game->winner == $team->team_key || $game->loser == $team->team_key) { $game->delete(); } } $team->delete(); $request->session()->flash('msg', 'Team ' . $team->name . ' deleted!'); } else { if ($request->input('reset') == "reset") { $team->games = 0; $team->wins = 0; $request->session()->flash('msg', 'Team ' . $team->name . ' reset!'); $team->save(); } else { $request->session()->flash('msg', 'Team ' . $team->name . ' updated!'); $team->save(); } } return $this->getEditTeam($request); }
public function postDecisions(LoggedInRequest $request, $id) { $previousApp = Application::findOrFail($id); $previousApp->status = $request->input('status'); $previousApp->mentor_id = $request->input('mentor') == "" ? null : $request->input('mentor'); $previousApp->statusEmailed = false; $previousApp->save(); $mentors = Mentor::orderBy('name')->get(); $application = Application::where('status', '')->orderByRaw('(appRating*0.2)+(interviewRating*0.8) DESC')->first(); $pageTitle = $application->name; return view('pages.decisions', compact('mentors', 'application', 'pageTitle')); }