From 7140efc561cc79832a12016b43c179f6f0336c59 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 24 Oct 2017 19:18:20 -0700 Subject: [PATCH] Use the transformers, Luke --- app/Http/Controllers/Api/UsersController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Api/UsersController.php b/app/Http/Controllers/Api/UsersController.php index 08d007f929..358e20df39 100644 --- a/app/Http/Controllers/Api/UsersController.php +++ b/app/Http/Controllers/Api/UsersController.php @@ -10,6 +10,7 @@ use App\Models\User; use App\Helpers\Helper; use App\Http\Requests\SaveUserRequest; use App\Models\Asset; +use App\Http\Transformers\AssetsTransformer; class UsersController extends Controller { @@ -209,6 +210,7 @@ class UsersController extends Controller { $this->authorize('view', User::class); $assets = Asset::where('assigned_to', '=', $id)->with('model')->get(); - return response()->json($assets); + return (new AssetsTransformer)->transformAssets($assets, $assets->count()); + // return response()->json($assets); } }