/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = GooglePlace::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(['lat' => $this->lat, 'lng' => $this->lng, 'location_id' => $this->location_id, 'utc_offset' => $this->utc_offset, 'user_rating_totals' => $this->user_rating_totals, 'rating' => $this->rating]); $query->andFilterWhere(['like', 'id', $this->id])->andFilterWhere(['like', 'place_id', $this->place_id])->andFilterWhere(['like', 'formatted_address', $this->formatted_address])->andFilterWhere(['like', 'adr_address', $this->adr_address])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'formatted_phone_number', $this->formatted_phone_number])->andFilterWhere(['like', 'international_phone_number', $this->international_phone_number])->andFilterWhere(['like', 'icon', $this->icon])->andFilterWhere(['like', 'url', $this->url])->andFilterWhere(['like', 'reference', $this->reference])->andFilterWhere(['like', 'scope', $this->scope])->andFilterWhere(['like', 'vicinity', $this->vicinity])->andFilterWhere(['like', 'website', $this->website])->andFilterWhere(['like', 'adress_street', $this->adress_street]); return $dataProvider; }
/** * Finds the GooglePlace model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return GooglePlace the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = GooglePlace::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }