<?php
$data = Order::where('user_id',$user_id)
->where('status', self::USABLE_STATUS)
->whereRaw('total_count>now_count')
->where(function ($q) use ($content_id) {
return $q->orWhere('type', 1)
->orWhereRaw('JSON_CONTAINS(content_ids, '."'[".$content_id.']'."')");
})
->select('id','title','content_ids')
->get()
->makeHidden('coupon_id');