/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = OutsideAttraction::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]);
     $query->andFilterWhere(['like', 'Outside_Attraction_name', $this->Outside_Attraction_name])->andFilterWhere(['like', 'Outside_Attraction_description', $this->Outside_Attraction_description])->andFilterWhere(['like', 'Outside_Attraction_let', $this->Outside_Attraction_let])->andFilterWhere(['like', 'Outside_Attraction_lng', $this->Outside_Attraction_lng])->andFilterWhere(['like', 'Outside_Attraction_image_file', $this->Outside_Attraction_image_file]);
     return $dataProvider;
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = OutsideAttraction::find();
     $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 $query->asArray()->all();
     }
     $query->orFilterWhere(['like', 'Outside_Attraction_name', $this->globalSearch])->orFilterWhere(['like', 'Outside_Attraction_description', $this->globalSearch])->orFilterWhere(['like', 'Outside_Attraction_let', $this->globalSearch])->orFilterWhere(['like', 'Outside_Attraction_lng', $this->globalSearch]);
     $raw = $query->asArray()->all();
     $returnArr = [];
     foreach ($raw as $row) {
         $detail = substr($row['Outside_Attraction_description'], 0, 200) . '...';
         $arrayRow = ['type' => 'outside-attraction', 'id' => $row['id'], 'title' => $row['Outside_Attraction_name'], 'detail' => $detail];
         array_push($returnArr, $arrayRow);
     }
     return $returnArr;
 }
 /**
  * Finds the OutsideAttraction model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return OutsideAttraction the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = OutsideAttraction::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemplo n.º 4
0
 public function getAllOutsideAttractions()
 {
     return OutsideAttraction::find()->asArray()->all();
 }