title: Laravel 5.2 eloquent query with local scope
body: <p>I wanted to know if its possible to use Laravel's local scope between two or more Models using join or sub query?</p>
  
  <p>For example this is User model with scope active.</p>
  
  <pre><code>class User extends Model
  {
      public function scopeActive($query)
      {
        return $query-&gt;where('active', 1);
      }
  }
  </code></pre>
  
  <p>Other Model is UserSubscription with scope.</p>
  
  <pre><code>class UserSubscription extends Model
  {
      public function scopeType($query, $type)
      {
        return $query-&gt;where('type', $type);
      }
  }
  </code></pre>
  
  <p>How to make use of both scopes in single query? Following statement will not work.</p>
  
  <pre><code>$users = Users::active()
          -&gt;join('UserSubscription', 'users.id', '=','UserSubscription.user_id')
          -&gt;UserSubscription::type()
          -&gt;get();
  </code></pre>
  
  <p>I am using Laravel 5.2. 
  <a href="https://laravel.com/docs/5.3/eloquent#local-scopes" rel="nofollow noreferrer">https://laravel.com/docs/5.3/eloquent#local-scopes</a></p>