Remove unneeded eager loads
This commit is contained in:
parent
c711278b8b
commit
9aede45918
1 changed files with 12 additions and 3 deletions
|
@ -395,13 +395,22 @@ class UsersController extends Controller
|
||||||
// Make sure the user can view users at all
|
// Make sure the user can view users at all
|
||||||
$this->authorize('view', User::class);
|
$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
|
// Make sure they can view this particular user
|
||||||
$this->authorize('view', $user);
|
$this->authorize('view', $user);
|
||||||
|
|
||||||
$userlog = $user->userlog->load('item');
|
return view('users/view', [
|
||||||
return view('users/view', compact('user', 'userlog'))->with('settings', Setting::getSettings());
|
'user' => $user,
|
||||||
|
'settings' => Setting::getSettings(),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue