} } if (empty($teamslist)) { return Redirect::to($slug); } return View::make('round.new', array('station' => $station, 'teams' => $teamslist)); }); // POST Create round for a team and station Route::post('(:any)/nyttlag', function ($slug) { Round::create(Input::all()); return Redirect::to($slug); }); // GET Form for editing a round Route::get('(:any)/(:num)', function ($slug, $team_id) { $station_id = Station::where('slug', '=', $slug)->only('id'); $round = Round::where_team_id_and_station_id($team_id, $station_id)->first(); return View::make('round.edit', array('round' => $round, 'station' => $round->station, 'team' => $round->team)); }); // GET Form for editing a round Route::put('(:any)/(:num)', function ($slug, $team_id) { $id = Round::where_station_id_and_team_id(Input::get('station_id'), Input::get('team_id'))->only('id'); Round::update($id, Input::all()); return Redirect::to($slug); }); // GET One station Route::get('(:any)', function ($slug) { $station = Station::where('slug', '=', $slug)->first(); if (empty($station)) { return Response::error('404'); } $teams = Team::all();