App\Traits\PermissionHasUsersTrait::boot PHP Метод

boot() публичный статический Метод

Boot the permission model Attach event listener to remove the many-to-many records when trying to delete Will NOT delete any records if the permission model uses soft deletes.
public static boot ( ) : void | boolean
Результат void | boolean
    public static function boot()
    {
        parent::boot();
        static::deleting(function ($permission) {
            if (!method_exists(Config::get('entrust.permission'), 'bootSoftDeletingTrait')) {
                // Repeat role->sync code attached from EntrustPermissionTrait::boot() as this boot()
                // function overwrites it.
                $permission->roles()->sync([]);
                $permission->users()->sync([]);
            }
            return true;
        });
    }