/**
  * Creates a new Customer model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Customer();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->customer_id]);
     }
     return $this->render('create', ['model' => $model]);
 }
示例#2
0
 public function run()
 {
     $model = new Customer();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
     } else {
         $errores = $model->getErrors();
     }
     return $this->render('customerRewards', ['model' => $model]);
 }
 /**
  * Creates a new Customer model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate($uid = null, $email = null)
 {
     $model = new Customer();
     if (isset($uid)) {
         $model->user_id = $uid;
     }
     if (isset($email)) {
         $model->email_address = $email;
     }
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->customer_id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
 /**
  * Creates a new EntpCustomer model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Customer();
     if ($model->load(Yii::$app->request->post())) {
         $model->loadDefaultValues();
         $model->save();
         if ($model->save()) {
             $cust = new EntpCustomer();
             $cust->customer_id = $this->id;
             $cust->entrepreneur_user_id = Yii::$app->user->id;
             $cust->link('customer', $model);
         }
         Yii::$app->session->setFlash('success', 'Create New Customer Success');
         return $this->redirect(['index']);
         //return $this->redirect(['view', 'entrepreneur_user_id' => $model->entrepreneur_user_id, 'customer_id' => $model->customer_id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
 /**
  * Updates an existing Project model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     $customer = new Customer();
     $user = new User();
     if ($model->load(Yii::$app->request->post()) && $customer->load(Yii::$app->request->post()) && $this->saveProject($model, $customer)) {
         return $this->redirect(['view', 'id' => $model->project_id]);
     } else {
         return $this->render('update', ['model' => $model, 'customer' => $customer, 'user' => $user]);
     }
 }