Esempio n. 1
0
 /**
  * Creates a new Plug model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Plug();
     $RQ = Yii::$app->request;
     if ($RQ->isPost) {
         $model->load($RQ->post());
         $model->images = JquploadHelper::jqformat();
         if ($model->save()) {
             UHelper::alert('添加成功', 'success');
             return $this->redirect(['update', 'id' => $model->id]);
         } else {
             UHelper::alert('添加失败', 'error');
         }
     }
     $model->images = [['label' => '示例图片', 'width' => 200, 'height' => 200]];
     $model->loadDefaultValues();
     return $this->render('create', ['model' => $model]);
 }