public function search($params) { $query = WarehouseModel::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id_warehouse' => $this->id_warehouse, 'id_branch' => $this->id_branch, 'create_by' => $this->create_by, 'update_by' => $this->update_by]); $query->andFilterWhere(['like', 'cd_whse', $this->cd_whse])->andFilterWhere(['like', 'nm_whse', $this->nm_whse])->andFilterWhere(['like', 'create_date', $this->create_date])->andFilterWhere(['like', 'update_date', $this->update_date]); return $dataProvider; }
public static function getWarehouseList($branch = false) { $query = Warehouse::find(); if ($branch !== false) { $query->where(['id_branch' => $branch]); } return ArrayHelper::map($query->asArray()->all(), 'id_warehouse', 'nm_whse'); }