Пример #1
0
 public function actionDelete($id)
 {
     $productType = \app\models\ProductType::find()->where(['id' => $id])->one();
     if (!empty($productType)) {
         if ($productType->delete()) {
             return $this->redirect(['index']);
         }
     }
 }
Пример #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = ProductType::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'product_type', $this->product_type]);
     return $dataProvider;
 }
Пример #3
0
    ?>
><?php 
    echo $ch2->changwat_name;
    ?>
</option>
                                            <?php 
}
?>
                                </select>
                            </div>
                            <div class="col-sm-4 col-md-4 col-lg-4">
                                ประเภทสินค้า
                                <select id="product_type" class="form-control">
                                    <option value=""> == ประเภทสินค้า ==</option>
                                    <?php 
$product_type = \app\models\ProductType::find()->all();
foreach ($product_type as $Ptype) {
    ?>
                                        <option value="<?php 
    echo $Ptype['id'];
    ?>
" <?php 
    if ($assign['product_type'] == $Ptype->id) {
        echo "selected";
    }
    ?>
><?php 
    echo $Ptype->product_type;
    ?>
</option>
                                            <?php