/** * Creates a new BMasters model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { if (Yii::$app->user->isGuest) { $this->redirect(Yii::$app->user->loginUrl); } $model = new BMasters(); if ($model->load(Yii::$app->request->post()) && $model->save()) { $model->images = json_encode($_POST[id_img]); if ($model->save()) { Yii::$app->getSession()->setFlash('create', 'true'); return $this->redirect(['index']); } } else { return $this->render('create', ['model' => $model]); } }