Ejemplo n.º 1
0
 /**
  * Creates a new Info model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate($id)
 {
     $this->layout = 'create_list';
     $model = new Info();
     if (Yii::$app->request->isPost) {
         $model->category_id = $id;
         $model->time = time();
         $model->user_id = 1;
     }
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         // ) {
         $model->move_images();
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         $view = Info::get_view($id);
         return $this->render('create', ['model' => $model, 'view' => $view, 'id' => $id]);
     }
 }