src/StripeObject.php
public static function boot()
    {
        parent::boot();

        static::addGlobalScope('type', function ($query) {
            return $query->when(static::class !== StripeObject::class, function ($query) {
                $query->where('type', class_basename((new static())->objectClass));
            });
        });

        static::created(function (StripeObject $object) {
            if ($object->relatesWith) {
                list($related, $tag) = $object->relatesWith;
                $object->relations(get_class($related))->attach($related->id, ['tag' => $tag]);
            }
        });
    }
public static function boot()
    {
        parent::boot();

        static::addGlobalScope('type', function ($query) {
            return $query->when(static::class !== StripeObject::class, function ($query) {
                $query->where('type', class_basename((new static())->objectClass));
            });
        });

        static::created(function (StripeObject $object) {
            if ($object->relatesWith) {
                list($related, $tag) = $object->relatesWith;
                $object->relations(get_class($related))->attach($related->id, ['tag' => $tag]);
            }
        });
    }
Add global scope 'type'
Attach pre-determined relation on creation.