title: How Can I Use Global Scope in Laravel Query Builder? (No Eloquent Model)
body: <p>I'm working with too many mysql large views. I don't want to use Eloquent Model for the views. </p>
  
  <p>I created "ViewBalance extends Illuminate\Support\Facades\DB". Everything worked as I wanted.</p>
  
  <p>But i need to set <strong>init()</strong> method for company scope.</p>
  
  <p>How can I use the global scope without <strong>init()</strong> method?</p>
  
  <p><strong>ViewModel</strong></p>
  
  <pre><code>&lt;?php
  
  namespace App\Models\Views;
  
  use App\Facades\CoreService;
  use Illuminate\Support\Facades\DB;
  
  class ViewBalance extends DB
  {
       const COMPANY_COLUMN = 'company_id';
       const TABLE = 'view_balances';
  
       public static function init()
       {
           return parent::table(self::COMPANY_COLUMN)
               -&gt;where(self::COMPANY_COLUMN, CoreService::companyId());
       }
  }
  </code></pre>
  
  <p><strong>In Controller</strong></p>
  
  <pre><code>&lt;?php
  
  $data = ViewBalance::init()-&gt;get(); // Worked!
  </code></pre>