Use the transformers, Luke

This commit is contained in:
snipe 2017-10-24 19:18:20 -07:00
parent 99be54fd96
commit 7140efc561

View file

@ -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);
}
}