public function search($params) { $query = SupplierModel::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id_supplier' => $this->id_supplier, 'create_by' => $this->create_by, 'update_by' => $this->update_by]); $query->andFilterWhere(['like', 'cd_supplier', $this->cd_supplier])->andFilterWhere(['like', 'nm_supplier', $this->nm_supplier])->andFilterWhere(['like', 'create_at', $this->create_at])->andFilterWhere(['like', 'update_at', $this->update_at]); return $dataProvider; }
/** * @inheritdoc */ public function rules() { return [[['nmSupplier'], 'in', 'range' => Supplier::find()->select(['nm_supplier'])->column()], [['id_supplier', 'nmSupplier', 'id_branch', 'id_warehouse', 'purchaseDate', 'purchase_value', 'status'], 'required'], [['id_branch', 'status'], 'integer'], [['purchase_date'], 'safe'], [['item_discount'], 'number']]; }