Example #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Brand::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, 'image_id' => $this->image_id, 'mark_id' => $this->mark_id]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
Example #2
0
/* @var $model app\modules\admin\models\Product */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="product-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'image_id')->textInput();
?>

    <?php 
echo $form->field($model, 'brand_id')->dropDownList(ArrayHelper::map(Brand::find()->all(), 'id', 'name'), ['prompt' => 'Выберите бренд']);
?>

    <?php 
echo $form->field($model, 'mark_id')->dropDownList(ArrayHelper::map(Mark::find()->all(), 'id', 'name'), ['prompt' => 'Выберите марку']);
?>

    <?php 
echo $form->field($model, 'typebeer_id')->dropDownList(ArrayHelper::map(Typebeer::find()->all(), 'id', 'name'), ['prompt' => 'Выберите тип']);
?>

    <?php 
echo $form->field($model, 'size_id')->dropDownList(ArrayHelper::map(Size::find()->all(), 'id', 'volume'), ['prompt' => 'Выберите объём']);
?>

    <?php