Laravel如何通过用户ID获取计数跟随者?

I have laravel jquery below

public function getFollower(Request $request){

      $userId = $request->get('user_id');

      $artists =  DB::table('artists')
      ->select('artists.id', 'artists.title as name ','artists.src as poster','followers.user_id',DB::raw('COUNT(followers.user_id) as followers'))
      ->leftjoin('followers', 'artists.id','=', 'followers.artist_id') 
      ->where('artists.status',0)
      ->groupBy('followers.artist_id')
      ->orderBy('followers.id', 'desc')
      ->get();

    return Response()->json(['data' => $artists], 200);
}

I want to get Result as below

 data: [
    {
      "id": 3,
      "name ": "Artist 3",
      "poster": "",
      "user_id": 1,
      "followers": 1
    },
    {
      "id": 2,
      "name ": "Hello Artist 2",
      "poster": "",
      "user_id": 1,
      "followers": 1
    },
    {
      "id": 1,
      "name ": "Thai",
      "poster": "",
      "user_id": 3,
      "followers": 10
    }
  ]

If I use ->where('followers.user_id',$userId) by result will get followers: 1 only

Anyone can help me how can I get result as above that I can use ->where('followers.user_id',$userId)

Thanks!

EDITED

This is a many to many relationship .. what you will do is

MODEL ARTIST

protected $appends = ['followers_count'];

public function followers()
{
    return $this->belongsToMany('App\User','follower','artist_id','user_id');
}

public function getFollowersCountAttribute()
{
    return count($this->followers);
}

MODEL USER

protected $appends = ['followed_count'];
public function artists()
{
    return $this->belongsToMany('App\Artist','follower','user_id','artist_id');
}

public function getFollowedCountAttribute()
{
    return count($this->artists);
}

in your CONTROLLER

public function getArtists(Request $request)
{
    $user_id = $request->get('user_id');
    // get the user using the user_id
    $follower = User::with('artists')->find($user_id);
    return response()->json(['data' => $follower ], 200);
 }

this will return you an array of data like

{
    id: 1,
    name:'You',
    followed_count: 2,
    artists: [
        {
            id:1,
            name: 'Demonyowh',
            follower_count: 9999,  
        },
        {
            id:5,
            name: 'Brian',
            follower_count: 9999,  
        },
    ],
}

Here is my Table structure

 1. users
  - id 
  - name

2. follower
  - id
  -user_id
  -artist_id

3. artists
  -id
  -name
  -src

Thank you for help