Mpociot\Teamwork\Traits\UserHasTeams::bootUserHasTeams PHP Method

bootUserHasTeams() public static method

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 bootUserHasTeams ( ) : void | boolean
return void | boolean
    public static function bootUserHasTeams()
    {
        static::deleting(function (Model $user) {
            if (!method_exists(Config::get('teamwork.user_model'), 'bootSoftDeletes')) {
                $user->teams()->sync([]);
            }
            return true;
        });
    }