/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Recommendations::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, 'userid' => $this->userid, 'kindid' => $this->kindid, 'created_at' => $this->created_at, 'longitude' => $this->longitude, 'latitude' => $this->latitude]); $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'location', $this->location])->andFilterWhere(['like', 'sellerphone', $this->sellerphone])->andFilterWhere(['like', 'reason', $this->reason])->andFilterWhere(['like', 'pictures', $this->pictures]); return $dataProvider; }
/** * Finds the Applyjobs model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Applyjobs the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Recommendations::findOne($id)) !== null) { return $model; } else { return false; } }
/** * @return \yii\db\ActiveQuery */ public function getRecommendations() { return $this->hasMany(Recommendations::className(), ['kind' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getRecommendation() { return $this->hasOne(Recommendations::className(), ['id' => 'recommendationid']); }
/** * Finds the Recommendations model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Recommendations the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Recommendations::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }