/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Tbtype::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 5]]); $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; }
?> <?php echo $form->field($model, 'tag')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'content')->textarea(['rows' => 6]); ?> <?php echo $form->field($model, 'file')->fileInput(); ?> <?php echo $form->field($model, 'type')->dropDownList(ArrayHelper::map(Tbtype::find()->all(), 'ID', 'Name'), ['prompt' => 'Select Category']); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div>