src/Traits/LaratrustPermissionTrait.php
public static function bootLaratrustPermissionTrait()
    {
        static::deleting(function ($permission) {
            if (!method_exists(Config::get('laratrust.models.permission'), 'bootSoftDeletes')) {
                $permission->roles()->sync([]);
            }
        });

        static::deleting(function ($permission) {
            if (method_exists($permission, 'bootSoftDeletes') && !$permission->forceDeleting) {
                return;
            }

            $permission->roles()->sync([]);

            foreach (array_keys(Config::get('laratrust.user_models')) as $key) {
                $permission->$key()->sync([]);
            }
        });
    }
public static function bootLaratrustPermissionTrait()
    {
        static::deleting(function ($permission) {
            if (!method_exists(Config::get('laratrust.models.permission'), 'bootSoftDeletes')) {
                $permission->roles()->sync([]);
            }
        });

        static::deleting(function ($permission) {
            if (method_exists($permission, 'bootSoftDeletes') && !$permission->forceDeleting) {
                return;
            }

            $permission->roles()->sync([]);

            foreach (array_keys(Config::get('laratrust.user_models')) as $key) {
                $permission->$key()->sync([]);
            }
        });
    }
public static function bootLaratrustPermissionTrait ( ) { static :: deleting ( function ( $ permission ) { if ( ! method_exists ( Config :: get ( 'laratrust.models.permission' ) , 'bootSoftDeletes' ) ) { $ permission -> roles ( ) -> sync ( [ ] ) ; } } ) ; static :: deleting ( function ( $ permission ) { if ( method_exists ( $ permission , 'bootSoftDeletes' ) && ! $ permission -> forceDeleting ) { return ; } $ permission -> roles ( ) -> sync ( [ ] ) ; foreach ( array_keys ( Config :: get ( 'laratrust.user_models' ) ) as $ key ) { $ permission -> $ key ( ) -> sync ( [ ] ) ; } } ) ; }
Boots the permission model and attaches 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.

@return void|bool
Boots the permission model and attaches 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 .