/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = DotaHero::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, 'status' => $this->status]); $query->andFilterWhere(['like', 'localized_name', $this->localized_name])->andFilterWhere(['like', 'name', $this->name]); return $dataProvider; }
/** * http://cdn.dota2.com/apps/dota2/images/heroes/<name>_<suffix> */ public static function updateHeroesImages() { $models = DotaHero::find()->all(); //echo'<pre>';print_r($models);echo'</pre>';die; foreach ($models as $model) { $url = self::HEROES_IMAGES_URL . $model->name . '_' . self::HEROES_IMAGE_FULL_QUALITY_VERTICAL_PORTRAIT; echo '<pre>'; print_r($url); echo '</pre>'; die; $raw_data = json_decode(DCurlHelper::getData($url), 1); } return true; }