/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Brend::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', 'name', $this->name]); return $dataProvider; }
<div class="items-form"> <?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?> <?php echo $form->field($model, 'name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'cat_id')->dropDownList(ArrayHelper::map(Category::find()->all(), 'id', 'name'), ['prompt' => '-- Выберите--'])->label('Категирия. <a href="/category/create"> Создать</a>'); ?> <?php echo $form->field($model, 'brend_id')->dropDownList(ArrayHelper::map(Brend::find()->all(), 'id', 'name'), ['prompt' => '-- Выберите--'])->label('Производиетель звукоснимателя. <a href="/brend/create"> Создать</a>'); ?> <?php echo $form->field($model, 'strings')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'anker')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'form')->textInput(['maxlength' => true]); ?> <?php