/**
  * Creates a new Lead model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Lead();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Example #2
0
 public function actionCreate()
 {
     $lead = new Lead();
     if ($lead->load(Yii::$app->request->post()) && $lead->save()) {
         Yii::$app->getSession()->setFlash("success", 'The record was saved.');
         return $this->redirect(["lead/"]);
     }
     return $this->render("create", ["models" => ["lead" => $lead]]);
 }