e.g.
$this->someModel
->someHasManyRelationship()
->where(...)
->where(function ($query)
makes the $query a Illuminate\Contracts\Database\Query\Builder
I'd expect Illuminate\Contracts\Database\Eloquent\Builder though?
A simple
Model::where(function ($query)
on the other hand is refactored to use Illuminate\Contracts\Database\Eloquent\Builder.