diff --git a/app/Album.php b/app/Album.php index 40b2757c..ec27190e 100644 --- a/app/Album.php +++ b/app/Album.php @@ -126,24 +126,24 @@ class Album extends Model $userRow = $album->users[0]; $userData = [ 'stats' => [ - 'views' => $userRow->view_count, - 'downloads' => $userRow->download_count, + 'views' => (int) $userRow->view_count, + 'downloads' => (int) $userRow->download_count, ], - 'is_favourited' => $userRow->is_favourited + 'is_favourited' => (bool) $userRow->is_favourited ]; } return [ - 'id' => $album->id, - 'track_count' => $album->track_count, + 'id' => (int) $album->id, + 'track_count' => (int) $album->track_count, 'title' => $album->title, 'slug' => $album->slug, 'created_at' => $album->created_at, 'stats' => [ - 'views' => $album->view_count, - 'downloads' => $album->download_count, - 'comments' => $album->comment_count, - 'favourites' => $album->favourite_count + 'views' => (int) $album->view_count, + 'downloads' => (int) $album->download_count, + 'comments' => (int) $album->comment_count, + 'favourites' => (int) $album->favourite_count ], 'covers' => [ 'small' => $album->getCoverUrl(Image::SMALL), @@ -151,7 +151,7 @@ class Album extends Model ], 'url' => $album->url, 'user' => [ - 'id' => $album->user->id, + 'id' => (int) $album->user->id, 'name' => $album->user->display_name, 'url' => $album->user->url, ], diff --git a/app/Http/Controllers/Api/Web/ArtistsController.php b/app/Http/Controllers/Api/Web/ArtistsController.php index 568674e3..a2a6e13f 100644 --- a/app/Http/Controllers/Api/Web/ArtistsController.php +++ b/app/Http/Controllers/Api/Web/ArtistsController.php @@ -133,16 +133,16 @@ class ArtistsController extends ApiControllerBase if ($user->users->count()) { $userRow = $user->users[0]; $userData = [ - 'is_following' => $userRow->is_followed + 'is_following' => (bool)$userRow->is_followed ]; } return Response::json([ 'artist' => [ - 'id' => $user->id, + 'id' => (int)$user->id, 'name' => $user->display_name, 'slug' => $user->slug, - 'is_archived' => $user->is_archived, + 'is_archived' => (bool)$user->is_archived, 'avatars' => [ 'small' => $user->getAvatarUrl(Image::SMALL), 'normal' => $user->getAvatarUrl(Image::NORMAL) diff --git a/app/Playlist.php b/app/Playlist.php index e4c037f3..63785991 100644 --- a/app/Playlist.php +++ b/app/Playlist.php @@ -86,25 +86,25 @@ class Playlist extends Model $userRow = $playlist->users[0]; $userData = [ 'stats' => [ - 'views' => $userRow->view_count, - 'downloads' => $userRow->download_count, + 'views' => (int) $userRow->view_count, + 'downloads' => (int) $userRow->download_count, ], - 'is_favourited' => $userRow->is_favourited + 'is_favourited' => (bool) $userRow->is_favourited ]; } return [ - 'id' => $playlist->id, + 'id' => (int) $playlist->id, 'track_count' => $playlist->track_count, 'title' => $playlist->title, 'slug' => $playlist->slug, 'created_at' => $playlist->created_at, - 'is_public' => $playlist->is_public, + 'is_public' => (bool) $playlist->is_public, 'stats' => [ - 'views' => $playlist->view_count, - 'downloads' => $playlist->download_count, - 'comments' => $playlist->comment_count, - 'favourites' => $playlist->favourite_count + 'views' => (int) $playlist->view_count, + 'downloads' => (int) $playlist->download_count, + 'comments' => (int) $playlist->comment_count, + 'favourites' => (int) $playlist->favourite_count ], 'covers' => [ 'small' => $playlist->getCoverUrl(Image::SMALL), @@ -112,7 +112,7 @@ class Playlist extends Model ], 'url' => $playlist->url, 'user' => [ - 'id' => $playlist->user->id, + 'id' => (int) $playlist->user->id, 'name' => $playlist->user->display_name, 'url' => $playlist->user->url, ], diff --git a/app/Track.php b/app/Track.php index 99eb3820..422d9122 100644 --- a/app/Track.php +++ b/app/Track.php @@ -229,41 +229,41 @@ class Track extends Model $userRow = $track->users[0]; $userData = [ 'stats' => [ - 'views' => $userRow->view_count, - 'plays' => $userRow->play_count, + 'views' => (int) $userRow->view_count, + 'plays' => (int) $userRow->play_count, 'downloads' => $userRow->download_count, ], - 'is_favourited' => $userRow->is_favourited + 'is_favourited' => (bool) $userRow->is_favourited ]; } return [ - 'id' => $track->id, + 'id' => (int) $track->id, 'title' => $track->title, 'user' => [ - 'id' => $track->user->id, + 'id' => (int) $track->user->id, 'name' => $track->user->display_name, 'url' => $track->user->url ], 'stats' => [ - 'views' => $track->view_count, - 'plays' => $track->play_count, - 'downloads' => $track->download_count, - 'comments' => $track->comment_count, - 'favourites' => $track->favourite_count + 'views' => (int) $track->view_count, + 'plays' => (int) $track->play_count, + 'downloads' => (int) $track->download_count, + 'comments' => (int) $track->comment_count, + 'favourites' => (int) $track->favourite_count ], 'url' => $track->url, 'slug' => $track->slug, - 'is_vocal' => $track->is_vocal, - 'is_explicit' => $track->is_explicit, - 'is_downloadable' => $track->is_downloadable, - 'is_published' => $track->isPublished(), + 'is_vocal' => (bool) $track->is_vocal, + 'is_explicit' => (bool) $track->is_explicit, + 'is_downloadable' => (bool) $track->is_downloadable, + 'is_published' => (bool) $track->isPublished(), 'published_at' => $track->published_at, 'duration' => $track->duration, 'genre' => $track->genre != null ? [ - 'id' => $track->genre->id, + 'id' => (int) $track->genre->id, 'slug' => $track->genre->slug, 'name' => $track->genre->name ] : null,