title: Register New Global Scope in Laravel
body: <p>I want to register a new global scope in Laravel 5.7 but I got the following error:</p>
  
  <blockquote>
    <p>Symfony \ Component \ Debug \ Exception \ FatalThrowableError
    (E_PARSE)
         syntax error, unexpected 'static' (T_STATIC)</p>
  </blockquote>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  namespace App;
  
  use Auth;
  use Illuminate\Database\Eloquent\Model;
  use Illuminate\Database\Eloquent\SoftDeletes;
  
  class Order extends Model
  {
      use SoftDeletes;
  
      /**
      * Anonymous scope
      */
      protected static function boot()
      {
          parent::boot();
  
          static::addGlobalScope('authenticated', function (Builder $builder) {
              $builder-&gt;where('id_user', '=', Auth::id());
          });
      }
  }
  </code></pre>
  
  <p>I'm using laravel 5.7 PHP 7.2</p>