/** * Creates a new Branches model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Branches(); if ($model->load(Yii::$app->request->post())) { $model->branch_created_date = date('Y-m-d'); $model->save(); return $this->redirect(['view', 'id' => $model->branch_id]); } else { return $this->renderAjax('create', ['model' => $model]); } }