Beispiel #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = College::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(['college_plan_id' => $this->college_plan_id]);
     $query->andFilterWhere(['like', 'school_plan_to_enroll_in', $this->school_plan_to_enroll_in])->andFilterWhere(['like', 'course_plan_to_take1', $this->course_plan_to_take1])->andFilterWhere(['like', 'course_plan_to_take2', $this->course_plan_to_take2]);
     return $dataProvider;
 }
Beispiel #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCollege()
 {
     return $this->hasOne(College::className(), ['college_plan_id' => 'applicant_id']);
 }
 public function actionCollege()
 {
     $model = new College();
     if ($model->load(Yii::$app->request->post())) {
         if ($user = $model->create()) {
             return $this->goHome();
         }
     }
     return $this->render('create', ['model' => $model]);
 }