I have a dropdown employee list in tickets form. In my employee model there’s a status ‘Available’ and ‘Not Available’
If I change the status of employee to ‘Not Available’ it won’t appear on the dropdown list. I have one employee that has set to ‘Not Available’ status but it still appears on the dropdown list.
Here’s what I did:
<?= $form->field($model, 'employee_id')->dropDownlist(
ArrayHelper::map(Employee::find([
'status' => 'Available'])->all(), 'id', 'employee_name'),
[
'prompt' => 'Select Employee ID',
'style' => 'width:200px'
]); ?>