Level 75
See answer here, and look at the links: I suggest use related data. https://laracasts.com/discuss/channels/nova/already-have-date-in-casts-property-but-it-shows-the-error-date-field-must-cast-to-date-in-eloquent-model
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Is there any way to convert this query to a query builder?
Because this returns an array.
SELECT
ref,
type,
question,
answers_array
FROM
filled_forms,
JSON_TABLE(
answers,
'$[*]' COLUMNS (
`ref` int(11) PATH '$.ref',
`type` text PATH '$.type',
`question` text PATH '$.question',
`answers_array` json PATH '$.answers'
)
) result
where
result.type = 'SELECT' AND form_report_id = 1")
Please or to participate in this conversation.