user(); $order = NannyOrder::withoutGlobalScope('store') ->where('customer_id', $customer->id) ->whereIn('status', [2, 3]) ->latest() ->first(); if (!$order) { return $this->success(null); } $order->load('nanny'); return $this->success([ 'order' => $order, 'nanny' => $order->nanny, ]); } /** * 月嫂订单列表(分页) */ public function orders(Request $request): JsonResponse { /** @var Customer $customer */ $customer = $request->user(); $query = NannyOrder::withoutGlobalScope('store') ->where('customer_id', $customer->id) ->with('nanny:id,name,level,phone'); return $this->paginate( $query->orderByDesc('id')->paginate(15) ); } }