original_string: public function scopeBetween($query, array $participants)
      {
          $query->whereHas('participants', function ($query) use ($participants) {
              $query->whereIn('user_id', $participants)
                      ->groupBy('thread_id')
                      ->havingRaw('COUNT(thread_id)='.count($participants));
          });
      }
code: public function scopeBetween($query, array $participants)
      {
          $query->whereHas('participants', function ($query) use ($participants) {
              $query->whereIn('user_id', $participants)
                      ->groupBy('thread_id')
                      ->havingRaw('COUNT(thread_id)='.count($participants));
          });
      }
code_tokens: public function scopeBetween ( $ query , array $ participants ) { $ query -> whereHas ( 'participants' , function ( $ query ) use ( $ participants ) { $ query -> whereIn ( 'user_id' , $ participants ) -> groupBy ( 'thread_id' ) -> havingRaw ( 'COUNT(thread_id)=' . count ( $ participants ) ) ; } ) ; }
docstring: Returns threads between given user ids
  
  @param $query
  @param $participants
  @return mixed
docstring_tokens: Returns threads between given user ids