Laravel hasManyThrough with constraint on intermediate Model
<p>Hi I have the following relationship between my entities.</p>

<pre><code>User
  - id
  - other stuff
NeighborhoodFilter
  - id
  - userId
  - neighborhoodId
  - isActive
Neighborhood
  - id
  - other stuff
</code></pre>

<p>I want to write a method for my User object that will return all Neighborhoods the User is a member of which is indicated by isActive = 1 in NeighborhoodFilter.</p>

<p>I have tried the following but I do not know where to put the constraint 'isActive=1'. Any ideas?</p>

<pre><code>public function neighborhoods()
{
    return $this-&gt;hasManyThrough('Neighborhood', 'NeighborhoodFilter', 'userId', 'id');
}
</code></pre>