/** * Creates a new Restaurant model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Restaurant(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->Id]); } else { return $this->render('create', ['model' => $model]); } }
public function actionLoadchain() { Yii::$app->response->format = Response::FORMAT_JSON; $model = new Restaurant(); $map = new \common\models\ResMap(); if ($model->load(Yii::$app->request->post())) { $chaindata = $model->chainCity; $chainmapstatus = $chaindata->chainFieldStatusMaps; \yii::trace(print_r($chainmapstatus, true)); $finalmap = []; foreach ($model->chainFieldMap() as $map) { $map['id'] = \yii\helpers\BaseHtml::getInputId($model, $map['id']); $map['lock'] = $chainmapstatus->{$map['value']}; $map['value'] = $chaindata->{$map['value']}; $finalmap[] = $map; } return ['responce' => ['map' => $finalmap]]; } else { return ['responce' => 'false']; } }