/**
  * Creates a new Clients model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Clients();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Пример #2
0
 public function actionNew()
 {
     $model = new Clients();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         $model->save();
         return $this->redirect(['/drivers/index']);
     }
     return $this->render('form', ['model' => $model, 'title' => 'Создать']);
 }