i think $var->options is a collection, so you can try
$var->options->map(fn($option) => (int)$option))->toArray()
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi There,
I have a pretty complex platfom with modular forms and dynamic conditions...
I run into a problem as the conditions are being saved in a sql cast as array. Then upon form submition I do check weither value is embedded in allowed values.
It works well if I consider strings only. When I have value it fails.
THe cast actually convert value to string and not integer or else.
When I generate dynamically the validation rule as such : array_push($t, Illuminate\Validation\Rule::in($var->options->pluck("value")->toArray()));
it fails because the value is an int which is compared to an array to string and not integer.
Any idea how to tackle that ?
Please or to participate in this conversation.