Esempio n. 1
0
 /**
  * Creates a new Reply model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Reply();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Esempio n. 2
0
 /**
  * 保存.
  *
  * @param App\Models\Reply $reply reply
  * @param array            $input input
  *
  * @return Reply 返回模型
  */
 public function savePost($reply, $input)
 {
     $reply->fill($input);
     $reply->save();
     return $reply;
 }