Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

hcphoon01's avatar

Laravel Eloquent query through array

If I have a column in a table that stores data as an array, how could I query that column to return all the rows that have an element in the array that matches a variable?

0 likes
2 replies
Sinnbeck's avatar

You can probably use a json column to store the array data and then use

Model->whereJsonContains('coiumn', 32);

Please or to participate in this conversation.