public function excel($params) { $query = Mon1str::find()->joinWith('monitoring1.user.profile.region'); $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => array('pageSize' => 10000)]); $dataProvider->sort->attributes['region'] = ['asc' => [Region::tableName() . '.name' => SORT_ASC], 'desc' => [Region::tableName() . '.name' => SORT_DESC]]; $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([Monitoring1::tableName() . '.date' => $this->date, Region::tableName() . '.id' => $this->region]); return $dataProvider; }