Ejemplo n.º 1
0
 public function actionBlogCreate()
 {
     $model = new BlogModel();
     if (isset($_POST['blog'])) {
         $model->setAttrs($_POST['blog']);
         $model->date = date("d.m.Y");
         if ($_FILES['mainImage']['name']) {
             $model->mainImage = File::save($_FILES['mainImage'], "assets/images/blog");
         }
         $model->save();
         $this->redirect("/admin/blog");
     }
     $this->view("admin/blog/create", array("model" => "BlogModel"), false);
 }