1$user_id = auth()->user()->id;
2
3Product::where('status', 'active')
4 ->whereNotIn('id', function($query) use ($user_id) {
5 $query->select('product_id')->from(new OrderProduct->getTable())
6 ->where('user_id', $user_id)->where('status', 'delivered')
7 ->pluck('product_id')->toArray();
8 });
1$user_id = auth()->user()->id;
2
3Product::where('status', 'active')
4 ->whereNotIn('id', function($query) use ($user_id) {
5 $query->select('product_id')->from((new OrderProduct)->getTable())
6 ->where('user_id', $user_id)->where('status', 'delivered')
7 ->pluck('product_id')->toArray();
8 });