Include correct license, asset, etc count on user show API call

This commit is contained in:
snipe 2019-12-19 18:09:53 -08:00
parent 779fc6d195
commit 324da7c0c8

View file

@ -229,7 +229,7 @@ class UsersController extends Controller
public function show($id)
{
$this->authorize('view', User::class);
$user = User::findOrFail($id);
$user = User::withCount('assets as assets_count','licenses as licenses_count','accessories as accessories_count','consumables as consumables_count')->findOrFail($id);
return (new UsersTransformer)->transformUser($user);
}