You can create a macro combing "With" and "WhereHas" - https://stackoverflow.com/questions/29591931/merge-with-and-wherehas-in-laravel-5
In the AppServiceProvider within the boot method do :
\Illuminate\Database\Eloquent\Builder\Eloquent::macro('withAndWhereHas', function($relation, $constraint){
return $this->whereHas($relation, $constraint)->with([$relation => $constraint]);
});
Next in your Thread model you can create a custom scope :
public function scopeWithUserVotes($query, $user_id) {
return $query->withAndWhereHas('vote', fn($q) => $q->where('user_id', $user_id));
}
Usage
Thread::withUserVotes(auth()->id());
Note - haven't tested it (check the stackoverflow thread)