user(); $userId = $user?->id ?? 0; return [ 'id' => $this->id, 'logs' => BargainOrderLogResource::collection($this->whenLoaded('logs')), 'expire_at'=> $this->expire_at->format('Y-m-d H:i:s'), 'status' => $this->status, 'user_nickname'=> $this->user->userInfo->nickname ?? '', 'user_avatar'=> $this->user->userInfo->avatar ?? '', 'is_owner' => $this->user_id == $userId ? true : false, ]; } }