From 9aede459188f4bf31b6bb299e55ea0f8fcf6ffdd Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Mon, 17 Mar 2025 14:43:23 -0700 Subject: [PATCH] Remove unneeded eager loads --- app/Http/Controllers/Users/UsersController.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Users/UsersController.php b/app/Http/Controllers/Users/UsersController.php index 1387aa8a9..761093911 100755 --- a/app/Http/Controllers/Users/UsersController.php +++ b/app/Http/Controllers/Users/UsersController.php @@ -395,13 +395,22 @@ class UsersController extends Controller // Make sure the user can view users at all $this->authorize('view', User::class); - $user = User::with('assets', 'assets.model', 'consumables', 'accessories', 'licenses', 'userloc')->withTrashed()->find($user->id); + $user = User::with([ + 'consumables', + 'accessories', + 'licenses', + 'userloc', + ]) + ->withTrashed() + ->find($user->id); // Make sure they can view this particular user $this->authorize('view', $user); - $userlog = $user->userlog->load('item'); - return view('users/view', compact('user', 'userlog'))->with('settings', Setting::getSettings()); + return view('users/view', [ + 'user' => $user, + 'settings' => Setting::getSettings(), + ]); }