if (Input::method() == 'POST') { $val = Model_Article::validate('create'); if ($val->run()) { $article = Model_Article::create_article(); if ($article) { Session::set_flash('success', '?lanek dodan #'.$user->id.'.'); Response::redirect('admin/users'); } else { Session::set_flash('error', 'Napaka pri dodajanju ?lanka.'); } } else { $errors = $val->error(); } }
public static function validate($factory) { $val = Validation::forge($factory); $val->add_field('category_id', 'Kategorija', 'required'); $val->add_field('title', 'Naslov ?lanka', 'required|max_length[500]'); $val->add_field('summary', 'Povzetek ?lanka', 'required|max_length[500]'); $val->add_field('body', 'Vsebina', 'required'); $val->add_field('tags', 'Tagi', 'required'); return $val; }
It looks like you're new here. If you want to get involved, click one of these buttons!