/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function searchByUserId($params)
 {
     $query = EducationCrud::find();
     $query->where(['user_id' => Yii::$app->user->getId()]);
     $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');
         $query->where(['user_id' => Yii::$app->user->getId()]);
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'institution_type' => $this->institution_type, 'from_date' => $this->from_date, 'to_date' => $this->to_date, 'graduated_status' => $this->graduated_status, 'gpa' => $this->gpa, 'gpa_max' => $this->gpa_max, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'created_by' => $this->created_by, 'updated_by' => $this->updated_by]);
     $query->andFilterWhere(['like', 'institution_name', $this->institution_name])->andFilterWhere(['like', 'institution_location', $this->institution_location])->andFilterWhere(['like', 'description', $this->description]);
     return $dataProvider;
 }
 /**
  * Finds the EducationCrud model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return EducationCrud the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = EducationCrud::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }