From 4ee21a2c1cc0a7578f7cf77eb299f7f7249853d9 Mon Sep 17 00:00:00 2001 From: "iVampireSP.com" Date: Wed, 1 Feb 2023 01:53:12 +0800 Subject: [PATCH] =?UTF-8?q?Bug=20=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Api/ReplyController.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/app/Http/Controllers/Api/ReplyController.php b/app/Http/Controllers/Api/ReplyController.php index 304ab7e..83874da 100644 --- a/app/Http/Controllers/Api/ReplyController.php +++ b/app/Http/Controllers/Api/ReplyController.php @@ -43,13 +43,6 @@ public function store(Request $request, WorkOrder $workOrder): JsonResponse return $this->error('工单状态异常,无法进行回复。请尝试重新建立工单。'); } - // 访客必须填写姓名 - if (!auth('sanctum')->check()) { - $this->validate($request, [ - 'name' => 'string|required|min:1|max:30', - ]); - } - // 如果工单已经关闭,那么访客不能回复 if ($workOrder->isClosed() && !auth('sanctum')->check()) { return $this->error('工单已关闭,无法进行回复。'); @@ -62,6 +55,7 @@ public function store(Request $request, WorkOrder $workOrder): JsonResponse if (auth('sanctum')->check()) { $create['user_id'] = auth('sanctum')->id(); + $create['name'] = auth('sanctum')->user()->name; } else { $this->validate($request, [ 'name' => 'string|required|min:1|max:255',