$this->id, 'sn' =>$this->sn, 'total_amount' => $this->total_amount, 'created_at' => $this->created_at->toDateTimeString(), 'status' => $this->status, 'is_consignor' => $request->user()->id == $this->consignor_id, //是否发货人身份 'products' => OrderProductResource::collection($this->whenLoaded('products')), 'user' => UserResource::make($this->whenLoaded('user')), ]; } }