/** * Creates a new JobLocation model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new JobLocation(); $model->setDefaultValues(); if ($model->load(Yii::$app->request->post())) { if ($model->save()) { if (Yii::$app->request->post('save_type') == 'apply') { return $this->redirect(['update', 'id' => (string) $model->_id]); } return $this->redirect(['view', 'id' => (string) $model->_id]); } } else { Yii::$app->view->title = Yii::t($this->module->id, 'Create'); Yii::$app->view->params['breadcrumbs'][] = ['label' => Yii::t($this->module->id, 'Manage Location'), 'url' => ['index']]; Yii::$app->view->params['breadcrumbs'][] = Yii::$app->view->title; return $this->render('form', ['model' => $model]); } }