/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Companyagency::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, 'companyAgencyCreate' => $this->companyAgencyCreate, 'companyAgencyUpdate' => $this->companyAgencyUpdate]); $query->andFilterWhere(['like', 'companyAgencyCode', $this->companyAgencyCode])->andFilterWhere(['like', 'companyAgencyName', $this->companyAgencyName])->andFilterWhere(['like', 'companyAgencyDesc', $this->companyAgencyDesc]); return $dataProvider; }
<?php echo $form->field($model, 'category_id')->dropDownList(ArrayHelper::map(\common\models\Category::find()->all(), 'id', 'categoryName'), ['prompt' => 'Category']); ?> <?php echo $form->field($model, 'type_id')->dropDownList(ArrayHelper::map(\common\models\Type::find()->all(), 'id', 'typeName'), ['prompt' => 'Type']); ?> <?php echo $form->field($model, 'priority_id')->dropDownList(ArrayHelper::map(\common\models\Priority::find()->all(), 'id', 'priorityName'), ['prompt' => 'Priority']); ?> <?php echo $form->field($model, 'companyAgency_id')->dropDownList(ArrayHelper::map(\common\models\Companyagency::find()->all(), 'id', 'companyAgencyName'), ['prompt' => 'Company Agency']); ?> <?php echo $form->field($model, 'section_id')->dropDownList(ArrayHelper::map(\common\models\Section::find()->all(), 'id', 'sectionName'), ['prompt' => 'Section']); ?> <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(); ?>