/** * Действие для создания матча */ public function action_create() { if (\Input::method() == 'POST') { $val = \Model_Match::validate('create'); if ($val->run()) { $match = \Model_Match::forge(array('team_1_id' => \Input::post('team_1_id'), 'team_2_id' => \Input::post('team_2_id'), 'status_id' => 1, 'season_id' => \Input::post('season_id'), 'date' => \Input::post('date') ? strtotime(\Input::post('date')) : NULL, 'name' => \Input::post('name'), 'vk_comments_count' => 0)); if ($match and $match->save()) { \Session::set_flash('success', 'Матч создано.'); \Response::redirect('admin/competitions/matches/edit/' . $match->id); } else { \Session::set_flash('error', 'Could not save match.'); } } else { \Session::set_flash('error', $val->error()); } } // Сезоны для select \View::set_global('seasons', \Model_Season::get_seasons_for_select()); $this->template->content = \View::forge('competitions/matches/create'); }