/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = REFERRALS::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['REFERRAL_ID' => $this->REFERRAL_ID]);
     $query->andFilterWhere(['like', 'REFERRAL_NAME', $this->REFERRAL_NAME])->andFilterWhere(['like', 'ADDRESS', $this->ADDRESS])->andFilterWhere(['like', 'CITY', $this->CITY])->andFilterWhere(['like', 'STATE', $this->STATE])->andFilterWhere(['like', 'ZIP', $this->ZIP])->andFilterWhere(['like', 'EMAIL', $this->EMAIL])->andFilterWhere(['like', 'PHONE', $this->PHONE])->andFilterWhere(['like', 'COMMENTS', $this->COMMENTS]);
     return $dataProvider;
 }
 /**
  * Finds the REFERRALS model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return REFERRALS the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = REFERRALS::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getREFERRAL()
 {
     return $this->hasOne(REFERRALS::className(), ['REFERRAL_ID' => 'REFERRAL_ID']);
 }