@marvinx No. Store your data properly, i.e. relationally if you want to query it effectively.
If you’re just going to smash your data in a JSON column then you may as well just store it in a JSON file on disk instead of in a relational database.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I need to query for a model where any json value matches the given parameter. All entries have the same keys even though some keys might be missing. The data is provided by another package so I cannot transfer the data into a separate table.
I currently do it like this but it looks really bad to me:
foreach ($keys as $key) {
$query->orWhere("{$field}->{$key}", $value);
}
I'd love to make a query similar to this:
$query->where("{$field}->.*", $value);
Example data:
{
a: "value-1",
b: "value-2",
c: "value-3"
}
Please or to participate in this conversation.