Laratrust\Traits\LaratrustGroupTrait::bootLaratrustGroupTrait PHP Method

bootLaratrustGroupTrait() public static method

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 group model uses soft deletes.
public static bootLaratrustGroupTrait ( ) : void | boolean
return void | boolean
    public static function bootLaratrustGroupTrait()
    {
        static::deleting(function ($group) {
            if (!method_exists(Config::get('laratrust.group'), 'bootSoftDeletes')) {
                $group->roles()->sync([]);
                $group->users()->sync([]);
            }
        });
    }