You can try this way
$searchModel = new EmployeeSearch(); $searchModel->role = 'regular'; $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
In the search model:
$query->andFilterWhere(['<>', 'role', $this->role]);
The second way to pass the second parameter, for example:
$dataProvider = $searchModel->search(Yii::$app->request->queryParams, $role = 'regular');
In the search model
if($role == 'regular') { $query->andWhere(['<>', 'role', $this->role]); }
Another way to pass another parameter, for example, a problem during filtering:
$dataProvider = $searchModel->search(Yii::$app->request->queryParams+['EmployeeSearch' => ['<>', 'role' =>'regular']]);
Hiren bhut
source share