Skip to content

Commit

Permalink
Added ShippingMethod::isZoneRestricted/isNotZoneRestricted methods
Browse files Browse the repository at this point in the history
  • Loading branch information
fulopattila122 committed Oct 4, 2023
1 parent 2ff6ac7 commit 27fa6de
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
- 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
- Added `isZoneRestricted()` & `isNotZoneRestricted()` helper methods to the `ShippingMethod` class
- Fixed possible null return type on Billpayer::getName() when is_organization is true but the company name is null

## 3.x Series
Expand Down
1 change: 1 addition & 0 deletions src/Shipment/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Dropped Laravel 9 Support
- Dropped Enum v3 Support
- Changed minimal Enum requirement to v4.1
- Added `isZoneRestricted()` & `isNotZoneRestricted()` helper methods to the `ShippingMethod` class

## 3.x Series

Expand Down
10 changes: 10 additions & 0 deletions src/Shipment/Models/ShippingMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,16 @@ public function estimate(?object $subject = null): ShippingFee
return $this->getCalculator()->calculate($subject, $this->configuration());
}

public function isZoneRestricted(): bool
{
return null !== $this->zone_id;
}

public function isNotZoneRestricted(): bool
{
return !$this->isZoneRestricted();
}

public function zone(): BelongsTo
{
return $this->belongsTo(ZoneProxy::modelClass(), 'zone_id', 'id');
Expand Down

0 comments on commit 27fa6de

Please sign in to comment.