/** * Display a confirmation page before destroy. * * @param int $id * @return \Illuminate\Http\Response */ public function delete($id) { $role = League::findOrFail($id); return view('league.delete', ['league' => $league]); }
/** * Update the specified tournament in storage. * * @param int $id id of tournament which should be updated * @return Response route where to redirect after update */ public function update($id) { $validator = Validator::make(Input::all(), Tournament::rules($id)); if ($validator->fails()) { return redirect('/tournaments/edit/' . $id)->withInput()->withErrors($validator); } $tournament = Tournament::findOrFail($id); $tournament->name = htmlspecialchars(Input::get('name')); $tournament->type = htmlspecialchars(Input::get('type')); $tournament->min_number_of_teams = Input::get('min_number_of_teams'); $tournament->max_number_of_teams = Input::get('max_number_of_teams'); $tournament->start_date = Input::get('start_date'); $tournament->end_date = Input::get('end_date'); $tournament->description = htmlspecialchars(Input::get('description')); $tournament->league()->associate(League::findOrFail(Input::get('league_id'))); $tournament->save(); return redirect('/tournaments'); // }
/** * Remove the league from storage. * * @param int $id * @return Response */ public function destroy($id) { $league = League::findOrFail($id); $league->delete(); return redirect('/leagues'); }