예제 #1
0
    /**
     * Creates data provider instance with search query applied
     *
     * @param array $params
     *
     * @return ActiveDataProvider
     */
    public function search($params)
    {
        $query = Benefit::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->joinWith('benefitScholar');
        
        $query->andFilterWhere([
            'benefit_id' => $this->benefit_id,
            'benefit_amount' => $this->benefit_amount,
            'benefit_scholarShare' => $this->benefit_scholarShare,
            'benefit_tuitionfee_id' => $this->benefit_tuitionfee_id,
            'benefit_scholar_id' => $this->benefit_scholar_id,
            'benefit_school_id' => $this->benefit_school_id,
        ]);

        $query->andFilterWhere(['like', 'scholars.scholar_lastName', $this->benefit_scholar_lastName])
            ->andFilterWhere(['like', 'scholars.scholar_firstName', $this->benefit_scholar_firstName])
            ->andFilterWhere(['like', 'scholars.scholar_middleName', $this->benefit_scholar_middleName]);

        return $dataProvider;
    }
예제 #2
0
 /**
  * Lists all Allowance models.
  * @return mixed
  */
 public function actionIndex()
 {
     $schools = Schools::find()->all();
     $users = User::find()->all();
     $scholars = Scholars::find()->all();
     $allowances = Allowance::find()->all();
     $benefits = Benefit::find()->all();
     return $this->render('index', array('users' => $users, 'scholars' => $scholars, 'schools' => $schools, 'allowances' => $allowances, 'benefits' => $benefits));
 }