Exemplo n.º 1
0
 /**
  * Creates a new Content model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Content();
     $model->user_id = 1;
     $model->content_type = $this->content_type;
     $model->loadDefaultValues();
     $bodyModel = $this->getBodyModel();
     $bodyModel->loadDefaultValues();
     if (($r = $this->saveContent($model, $bodyModel)) !== false) {
         return $r;
     }
     return $this->render('create', ['model' => $model, 'bodyModel' => $bodyModel]);
 }
Exemplo n.º 2
0
 public function actionCreate()
 {
     $model = new Content();
     $model->user_id = LuLu::$app->user->identity->id;
     $model->user_name = LuLu::$app->user->identity->username;
     $model->content_type = $this->content_type;
     $model->loadDefaultValues();
     $bodyModel = $this->findBodyModel();
     $bodyModel->loadDefaultValues();
     if (($r = $this->saveContent($model, $bodyModel)) !== false) {
         return $r;
     }
     return $this->render('create', ['model' => $model, 'bodyModel' => $bodyModel]);
 }
 public function actionCreate()
 {
     $model = new Content();
     $model->user_id = LuLu::getIdentity()->id;
     $model->user_name = LuLu::getIdentity()->username;
     $model->content_type = $this->content_type;
     $model->loadDefaultValues();
     $bodyModel = $this->findBodyModel();
     $bodyModel->loadDefaultValues();
     if ($this->saveContent($model, $bodyModel)) {
         return $this->redirect(['index']);
     }
     return $this->render('create', ['model' => $model, 'bodyModel' => $bodyModel]);
 }