authService->updateProfile(auth('client')->user(), $request->validated()); $user = $result['client']; if (!empty($result['dirty'])) { $this->activityLogger->log( event: 'profile_update', logName: 'Customer', description: "Customer {$user->email} cập nhật thông tin cá nhân: " . implode(', ', array_keys($result['dirty'])), subject: $user, oldValues: $result['old'], newValues: array_diff_key($result['dirty'], array_flip(['password', 'remember_token'])), ); } return response()->json([ 'error' => false, 'message' => 'Cập nhật thông tin thành công', 'data' => [ 'client' => new ClientResource($user), ], ]); } public function updateCccd(ClientUpdateCccdRequest $request) { // Disk private: phía client chỉ nhận trạng thái đã cập nhật, không nhận đường dẫn ảnh. $frontUrl = $request->file('cmnd_before')->store('cccd', 'local'); $backUrl = $request->file('cmnd_after')->store('cccd', 'local'); $result = $this->authService->updateCccd( auth('client')->user(), $request->validated('cmnd'), $frontUrl, $backUrl, ); $user = $result['client']; if (!empty($result['dirty'])) { $this->activityLogger->log( event: 'cccd_update', logName: 'Customer', description: "Customer {$user->email} cập nhật chứng minh thư", subject: $user, oldValues: $result['old'], newValues: $result['dirty'], ); } return response()->json([ 'error' => false, 'message' => 'Cập nhật chứng minh thư thành công', 'data' => [ 'client' => new ClientResource($user), ], ]); } }