From 19f3a71c0347d0a445d091f8060299d77a9fd1e3 Mon Sep 17 00:00:00 2001 From: Bubka <858858+Bubka@users.noreply.github.com> Date: Mon, 24 Feb 2025 13:48:03 +0100 Subject: [PATCH] Move group->loadCount from the Assign void method to the caller --- app/Api/v1/Controllers/GroupController.php | 1 + app/Services/GroupService.php | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/Api/v1/Controllers/GroupController.php b/app/Api/v1/Controllers/GroupController.php index b42b002a..53bc544b 100644 --- a/app/Api/v1/Controllers/GroupController.php +++ b/app/Api/v1/Controllers/GroupController.php @@ -104,6 +104,7 @@ class GroupController extends Controller try { Groups::assign($validated['ids'], $request->user(), $group); + $group->loadCount('twofaccounts'); } catch (ModelNotFoundException $exc) { abort(404); } diff --git a/app/Services/GroupService.php b/app/Services/GroupService.php index c319da4e..882fb3d7 100644 --- a/app/Services/GroupService.php +++ b/app/Services/GroupService.php @@ -74,8 +74,6 @@ class GroupService Log::info(sprintf('Twofaccounts #%s assigned to group %s (ID #%s)', implode(',', $ids), var_export($group->name, true), $group->id)); }); - - $group->loadCount('twofaccounts'); } else { Log::info('Cannot find a group to assign the TwoFAccounts to'); }