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