title: Fetch Active User Locations
body: <p>I have below tables with following fields</p>
  
  <p>admins Table</p>
  
  <pre><code> -&gt;id (int)
   -&gt;name (string)
   -&gt;status (boolean)
  </code></pre>
  
  <p>locations Table</p>
  
  <pre><code>-&gt;id (int)
  -&gt;name (string
  </code></pre>
  
  <p>)</p>
  
  <p>I have many to many relation between this two tables via pivot table</p>
  
  <p>admin_locations</p>
  
  <pre><code> -&gt;admin_id
   -&gt;location_id
  </code></pre>
  
  <p>My Model</p>
  
  <pre><code>Admin.php
  
  public function locations()
      {
          return $this-&gt;belongsToMany('App\Location', 'admin_location');
      }
  
  Location.php
      public function admin()
      {
          return $this-&gt;belongsToMany('App\Admin','admin_location');
      }
  </code></pre>
  
  <p>I want to fetch only admin whose status is 1 along with the relationship. I'm using the above query to fetch admin locations. How can i fetch admin locations where admin status is 1.</p>