For the very same example there is a great functionality for where statements. There is a whereColumn method for that purpose.
But as i can see in the Query Builder API there is no such functionality for having, so you will have to stick the havingRaw option, which is actually just fine.