App\Traits\UserHasPermissionsTrait::boot PHP Méthode

boot() public static méthode

Boot the user model Attach event listener to remove the many-to-many records when trying to delete Will NOT delete any records if the user model uses soft deletes.
public static boot ( ) : void | boolean
Résultat void | boolean
    public static function boot()
    {
        parent::boot();
        static::deleting(function ($user) {
            if (!method_exists(Config::get('auth.model'), 'bootSoftDeletingTrait')) {
                // Repeat role->sync code attached from EntrustUserTrait::boot() as this boot()
                // function overwrites it.
                $user->roles()->sync([]);
                $user->permissions()->sync([]);
            }
            return true;
        });
    }