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
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2AtxT4u
via IFTTT
Aucun commentaire:
Enregistrer un commentaire