Example of HasManyThrough in pixelfed/pixelfed

File app/Status.php (link to Github)
use Illuminate\Database\Eloquent\Model;

class Status extends Model
{
    //
    public function likedBy()
    {
        return $this->hasManyThrough(
            Profile::class,
            Like::class,
            'status_id',
            'id',
            'id',
            'profile_id'
        );
    }
    //
}

Additional resources on HasManyThrough: