/**
  * Creates a new Brand model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Brand();
     $model->scenario = $model::SCENARIO_CREATE;
     if ($model->load(Yii::$app->request->post())) {
         $transaction = $model->getDb()->beginTransaction();
         try {
             if ($model->validate()) {
                 $model->save(false);
                 $transaction->commit();
                 Yii::$app->session->setFlash('success', 'Brand have been added.');
                 return $this->redirect('index');
             }
         } catch (Exception $e) {
             $transaction->rollBack();
         }
     }
     return $this->render('create', ['model' => $model]);
 }