laravel/framework — pull request #6850 by jbruni (2014-12-30 06:25:29+00:00)
Title: 'has' clause on 'hasMany' relationships with self relation

"*Eloquent does not alias tables in a self join relationship*" is the title of this Liferaft issue: https://github.com/laravel/laravel/pull/3127 (brought randomly by a `liferaft grab`).

This PR seems to solve the OP issue, which uses a "hasMany" relationship.

Implementation based on https://github.com/laravel/framework/commit/16f099e0bc17d89f1e11aff6343b2999230560a3