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