/** * Creates a new Sell model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Sell(); $brand_array = $this->getAllBrand(); $model_array = $this->getAllModel($model->getAttribute('brand')); if ($model->load(Yii::$app->request->post())) { if ($model->beforeSave(true) && $model->save()) { $model->addCustomer(); $model->setStatus(); return $this->redirect(['view', 'id' => $model->id]); } } else { return $this->render('create', ['model' => $model, 'brand_array' => $brand_array, 'model_array' => $model_array]); } }