/**
  * Creates a new MerchantBrand model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new MerchantBrand();
     $postReq = Yii::$app->request->post();
     if (!empty($postReq)) {
         $upload_file1 = $model->uploadFile('upload_file1');
         $upload_file2 = $model->uploadFile('upload_file2');
         $searchkeywords = $postReq['MerchantBrand']['merchant_brand_search_keywords'];
         $postReq['MerchantBrand']['merchant_brand_search_keywords'] = explode(",", $searchkeywords);
         $postReq['MerchantBrand']['merchant_brand_status'] = 1;
         $model->load($postReq);
         if ($model->insert()) {
             if ($upload_file1 !== false) {
                 $path1 = $model->getUploadedFile('logo_img');
                 $upload_file1->saveAs($path1);
             }
             if ($upload_file2 !== false) {
                 $path2 = $model->getUploadedFile('logo_img_mobile');
                 $upload_file2->saveAs($path2);
             }
             return $this->redirect(['view', 'id' => (string) $model->_id]);
         } else {
             echo "failed: ";
             var_dump($model->errors);
         }
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }