mardi 27 novembre 2018

laravel syntax error, unexpected 'static' (T_STATIC)

i want to create global scope in laravel 5.7 but i got this error

 Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_PARSE)
 syntax error, unexpected 'static' (T_STATIC)

and this is my code

/**
* Anonymous scope
*/
protected static function boot()
{
    parent::boot();
​
    static::addGlobalScope('authenticated', function (Builder $builder) {
        $builder->where('id_user', '=', Auth::id());
    });
}

i'm using laravel 5.7 PHP 7.2



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire