all ok if you just retrieve it as it is?
You could create a cast in the eloquent model?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi Mates, I'm in a scenario where I need to cast from string to integer in Select statement. I tried a couple of ways but it didn't work out for me. any help/suggestion that would be great. TIA
$students = Student::select([
'id',
'name',
'year',
'subjects->subject5_number as subject5_number'
])
->where('year', 2019)
->orderBy('subject5_number')->get();
Please or to participate in this conversation.