This is my code.
[['pdf'], 'file'],
[['pdf'], 'required', 'when' => function($model) {
return $model->active == 1;
}],
I’ve also tried by adding
[['pdf'], 'file', 'skipOnEmpty' => true]
and
[['pdf'], 'file', 'skipOnEmpty' => false]
What am I doing wrong?