Check a column is empty array or not in Laravel

Viewed 441

I have a json column which is set as null by default and casted as array in model. I've used

->where('column_name', '\[\]')->get();

It retrun empty collection.

My question is if i've to check whether a column is empty array or not in where condition what will i do?

1 Answers

thanks to this answer

where('column_name',DB::raw("json_array()"))->get();
Related