M
M
Mirzamorph2020-11-09 18:08:02
Laravel
Mirzamorph, 2020-11-09 18:08:02

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();



5fa95ad3c7bab412074301.png
5fa95b0741903614385605.png

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question