I am looking to set a condition only for a single action in the controller, so I don't want to change my search
model.
My code looks like this:
public function actionRoles()
{
$searchModel = new EmployeeSearch();
//$searchModel->query()->where('role <> regular');
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('view_role', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
The commmented row shows my condition ($searchModel->query()->where('role <> regular');
), it's pretty straightforward but I have not found a solution that works online.
For reference I tried those:
role
regular
. Will report back on the rest. – Steric