with(['store']) ->where(['type' => $type]) ->where(function ($query) use ($marketId) { $query->whereJsonContains("market_ids", [(string)$marketId]) ->orWhereJsonLength("market_ids", '=', 0); }); return $builder->get()->toArray(); } }