Answer the question
In order to leave comments, you need to log in
How to compare value with json column in laravel?
Good afternoon
There is a cart_items table, it has a json modifiers column. I'm trying to do the following through the eloquent model:
It doesn't work for me, I can't even compare an empty column, not that there are any values there.
That's how it finds
On the CartItem model I use cast: modifiers => object
Tried to disable, there was no sense
Screenshots of the base and code are attached:
CartItems::where('modifiers', '[]')->get();
CartItems::where('product_id', '1')->get();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question