From 66ebf3f1afacda986b52a28b3bbd1b4d81cbfa04 Mon Sep 17 00:00:00 2001 From: cody <648753004@qq.com> Date: Wed, 25 Jun 2025 14:52:01 +0800 Subject: [PATCH] update --- app/Http/Controllers/Mobile/SupplyDemandController.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Mobile/SupplyDemandController.php b/app/Http/Controllers/Mobile/SupplyDemandController.php index 9205b42..2bc94db 100755 --- a/app/Http/Controllers/Mobile/SupplyDemandController.php +++ b/app/Http/Controllers/Mobile/SupplyDemandController.php @@ -46,7 +46,11 @@ class SupplyDemandController extends CommonController public function index() { $all = request()->all(); - $supplyDemands = SupplyDemand::where(function ($query) use ($all) { + $supplyDemands = SupplyDemand::with([ + 'user' => function ($query) { + $query->select('id', 'nickname', 'name', 'headimgurl'); + } + ])->where(function ($query) use ($all) { if (isset($all['type'])) { $query->where('type', $all['type']); } @@ -345,7 +349,7 @@ class SupplyDemandController extends CommonController $query->select('id', 'nickname', 'name', 'headimgurl'); } ])->where(function ($query) use ($all) { - $query->where('user_id',$this->getUserId())->orWhere('to_user_id',$this->getUserId()); + $query->where('user_id', $this->getUserId())->orWhere('to_user_id', $this->getUserId()); })->orderBy($all['sort_name'] ?? 'id', $all['sort_type'] ?? 'desc') ->paginate($all['page_size'] ?? 20); return $this->success(compact('dialogue'));