disabled select option multiple value base on status from db
I have Select Option Its Disabled Option value when status by id is sold
Select::make('batch_id')
->required()
->relationship('batch_faktur_pajak', 'batch')
->options(BatchFakturPajak::all()->pluck('batch', 'id'))
->live(debounce: 1500)
->disableOptionWhen(function ($value) {
$get_status = BatchFakturPajak::where('status', '=', 'sold')->get();
foreach ($get_status as $status) {
if ($status->id == $value) {
return true;
} else {
return false;
}
}
})
i have 10 and 20 value bot sold status
but On Select It Disabled Only 10
i know because it return bool but i dkw how to fix that
Select::make('batch_id')
->required()
->relationship('batch_faktur_pajak', 'batch')
->options(BatchFakturPajak::all()->pluck('batch', 'id'))
->live(debounce: 1500)
->disableOptionWhen(function ($value) {
$get_status = BatchFakturPajak::where('status', '=', 'sold')->get();
foreach ($get_status as $status) {
if ($status->id == $value) {
return true;
} else {
return false;
}
}
})
i have 10 and 20 value bot sold status
but On Select It Disabled Only 10
i know because it return bool but i dkw how to fix that

