From 42410150a2af753e42695e5f80c43794632ad096 Mon Sep 17 00:00:00 2001 From: Attila Fulop <1162360+fulopattila122@users.noreply.github.com> Date: Fri, 8 Sep 2023 16:36:50 +0300 Subject: [PATCH] Added channelable PaymentMethod & ShippingMethod models to Foundation --- Changelog.md | 2 +- src/Foundation/Models/PaymentMethod.php | 23 +++++++++++++++++++ src/Foundation/Models/ShippingMethod.php | 23 +++++++++++++++++++ .../Providers/ModuleServiceProvider.php | 10 ++++++++ 4 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 src/Foundation/Models/PaymentMethod.php create mode 100644 src/Foundation/Models/ShippingMethod.php diff --git a/Changelog.md b/Changelog.md index 6a4bd940..e61d86a6 100644 --- a/Changelog.md +++ b/Changelog.md @@ -17,7 +17,7 @@ - Added the `withImages` method to the product search class (eager loads media) - Added the `channelables` table for being many-to-many polymorphic relationships with channels and arbitrary models - Added the `mapInto()` method to the `RelationAdjustmentCollection` class, which forwards the call to the underlying Eloquent collection -- Added the `Channelable` behavior to Foundation Product, MasterProduct and Taxonomy classes +- Added the `Channelable` behavior to Foundation Product, MasterProduct, PaymentMethod, ShippingMethod and Taxonomy classes - Added and extended Foundation Channel model that contains the known relationships to the "channelable" models - Added the `withinChannel[s]` methods to the ProductSearch class - Added the `Features` accessor class, which is a syntactic sugar for areas of the configuration diff --git a/src/Foundation/Models/PaymentMethod.php b/src/Foundation/Models/PaymentMethod.php new file mode 100644 index 00000000..fac66653 --- /dev/null +++ b/src/Foundation/Models/PaymentMethod.php @@ -0,0 +1,23 @@ +concord->registerModel(ShipmentContract::class, Shipment::class, $registerRouteModels); $this->concord->registerModel(MasterProductContract::class, MasterProduct::class, $registerRouteModels); $this->concord->registerModel(MasterProductVariantContract::class, MasterProductVariant::class, $registerRouteModels); + $this->concord->registerModel(ShippingMethodContract::class, ShippingMethod::class, $registerRouteModels); + $this->concord->registerModel(PaymentMethodContract::class, PaymentMethod::class, $registerRouteModels); Relation::morphMap([ // @todo remove this bullshit in v4. It's not event part of the interface @@ -97,6 +105,8 @@ public function boot() 'order' => OrderProxy::modelClass(), 'cart' => CartProxy::modelClass(), 'shipment' => ShipmentProxy::modelClass(), + 'shipping_method' => ShippingMethodProxy::modelClass(), + 'payment_method' => PaymentMethodProxy::modelClass(), 'channel' => ChannelProxy::modelClass(), ]);