self::ADDRESS_TYPE_BILLING, ]; /** * The "booted" method of the model. */ protected static function boot(): void { static::addGlobalScope('address_type', static function (Builder $builder) { $builder->whereIn('address_type', [ self::ADDRESS_TYPE_BILLING, self::ADDRESS_TYPE_SHIPPING, ]); }); parent::boot(); } /** * Get the shipping rates for the cart address. */ public function shipping_rates(): HasMany { return $this->hasMany(CartShippingRateProxy::modelClass()); } /** * Get the cart record associated with the address. */ public function cart(): BelongsTo { return $this->belongsTo(CartProxy::modelClass()); } /** * Create a new factory instance for the model */ protected static function newFactory(): Factory { return CartAddressFactory::new(); } }