/** * Creates a new CustomerOrder model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new CustomerOrder(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['/customer/customer/update', 'id' => $model->customer->id]); } else { $customer_id = Yii::$app->request->get('customer_id', null); if (!empty($customer_id)) { $model->customer_id = $customer_id; } if (Yii::$app->request->isAjax) { return $this->renderAjax('create', ['model' => $model]); } else { return $this->render('create', ['model' => $model]); } } }