/**
  * Creates a new Product model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Product();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         // data product
         $data_product = $_POST['Product'];
         // name product
         foreach ($data_product as $vlProduct) {
             $name_product = $vlProduct;
         }
         // last id catalog
         $last_product = Product::find()->orderBy('id_product DESC')->one();
         $last = $last_product->id_product;
         // insert search_table
         $search_product = new SearchTable(['name_search' => $name_product, 'type_search' => '3', 'link_search' => $last]);
         $search_product->save();
         return $this->redirect(['view', 'id' => $model->id_product]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
 /**
  * Creates a new Catalog model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Catalog();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         // data catalog
         $data_catalog = $_POST['Catalog'];
         // name catalog
         foreach ($data_catalog as $vlCatalog) {
             $name_catalog = $vlCatalog;
         }
         // last id catalog
         $last_catalog = Catalog::find()->orderBy('id_catalog DESC')->one();
         $last = $last_catalog->id_catalog;
         // insert search_table
         $search_catalog = new SearchTable(['name_search' => $name_catalog, 'type_search' => '1', 'link_search' => $last]);
         $search_catalog->save();
         return $this->redirect(['view', 'id' => $model->id_catalog]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
 /**
  * Creates a new Section model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Section();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         // data section
         $data_section = $_POST['Section'];
         // name catalog
         foreach ($data_section as $vlSection) {
             $name_section = $vlSection;
         }
         // last id catalog
         $last_section = Section::find()->orderBy('id_section DESC')->one();
         $last = $last_section->id_section;
         // insert search_table
         $search_section = new SearchTable(['name_search' => $name_section, 'type_search' => '2', 'link_search' => $last]);
         $search_section->save();
         return $this->redirect(['view', 'id' => $model->id_section]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }