diff --git a/app/Http/Controllers/Api/Web/ArtistsController.php b/app/Http/Controllers/Api/Web/ArtistsController.php index 2a9f2893..1f3015fc 100644 --- a/app/Http/Controllers/Api/Web/ArtistsController.php +++ b/app/Http/Controllers/Api/Web/ArtistsController.php @@ -28,6 +28,7 @@ use Poniverse\Ponyfm\Http\Controllers\ApiControllerBase; use Poniverse\Ponyfm\Models\Image; use Poniverse\Ponyfm\Models\Track; use Poniverse\Ponyfm\Models\User; +use Poniverse\Ponyfm\Models\Follower; use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Input; use Illuminate\Support\Facades\Response; @@ -173,6 +174,9 @@ class ArtistsController extends ApiControllerBase $palette = ColorThief::getPalette($user->getAvatarUrl(Image::SMALL), 2); $formatted_palette = array_map("Helpers::rgb2hex", $palette); + $followers = Follower::where('artist_id', $user->id) + ->count(); + return Response::json([ 'artist' => [ 'id' => $user->id, @@ -185,7 +189,7 @@ class ArtistsController extends ApiControllerBase ], 'avatar_colors' => $formatted_palette, 'created_at' => $user->created_at, - 'followers' => [], + 'followers' => $followers, 'following' => [], 'latest_tracks' => $latestTracks, 'comments' => $comments, diff --git a/public/templates/artists/_show_layout.html b/public/templates/artists/_show_layout.html index c63efdc5..68709e7c 100644 --- a/public/templates/artists/_show_layout.html +++ b/public/templates/artists/_show_layout.html @@ -4,6 +4,13 @@