models/searchs/Assignment.php
public function search($params, $class, $usernameField)
    {
        $query = $class::find();
        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        if (!($this->load($params) && $this->validate())) {
            return $dataProvider;
        }

        $query->andFilterWhere(['like', $usernameField, $this->username]);

        return $dataProvider;
    }
public function search($params, $class, $usernameField)
    {
        $query = $class::find();
        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        if (!($this->load($params) && $this->validate())) {
            return $dataProvider;
        }

        $query->andFilterWhere(['like', $usernameField, $this->username]);

        return $dataProvider;
    }
public function search ( $ params , $ class , $ usernameField ) { $ query = $ class :: find ( ) ; $ dataProvider = new ActiveDataProvider ( [ 'query' => $ query , ] ) ; if ( ! ( $ this -> load ( $ params ) && $ this -> validate ( ) ) ) { return $ dataProvider ; } $ query -> andFilterWhere ( [ 'like' , $ usernameField , $ this -> username ] ) ; return $ dataProvider ; }
Create data provider for Assignment model.
@param  array                        $params
@param  \yii\db\ActiveRecord         $class
@param  string                       $usernameField
@return \yii\data\ActiveDataProvider
Create data provider for Assignment model .