CanDuplicate.php
1 year ago
CanFilter.php
3 weeks ago
CanFinalize.php
3 years ago
CanResendNotifications.php
1 year ago
HasAffiliation.php
2 years ago
HasAttributes.php
1 year ago
HasAutoFeeRules.php
5 months ago
HasBillingAddress.php
7 months ago
HasCharge.php
4 years ago
HasCheckout.php
3 years ago
HasCommissionStructure.php
2 years ago
HasCoupon.php
4 years ago
HasCustomer.php
4 years ago
HasDates.php
1 year ago
HasDiscount.php
1 year ago
HasDisputes.php
9 months ago
HasFees.php
11 months ago
HasImageSizes.php
2 years ago
HasInvoice.php
1 year ago
HasLicense.php
2 years ago
HasLineItem.php
2 years ago
HasOrder.php
4 years ago
HasPaymentFailures.php
1 year ago
HasPaymentInstrument.php
1 year ago
HasPaymentIntent.php
4 years ago
HasPaymentMethod.php
4 years ago
HasPayout.php
2 years ago
HasPayouts.php
2 years ago
HasPlatformFee.php
1 year ago
HasPrice.php
4 years ago
HasProcessorType.php
4 years ago
HasProduct.php
4 years ago
HasPromotion.php
1 year ago
HasPurchase.php
4 years ago
HasPurchases.php
4 years ago
HasReferral.php
2 years ago
HasReferralItems.php
2 years ago
HasReferrals.php
2 years ago
HasRefund.php
4 years ago
HasRefundItems.php
1 year ago
HasServiceFee.php
1 year ago
HasShippingAddress.php
7 months ago
HasShippingChoices.php
1 year ago
HasShippingMethod.php
1 year ago
HasSubscription.php
4 years ago
HasSubscriptions.php
4 years ago
HasSwap.php
1 year ago
SyncsCustomer.php
3 years ago
HasShippingAddress.php
27 lines
| 1 | <?php |
| 2 | |
| 3 | namespace SureCart\Models\Traits; |
| 4 | |
| 5 | trait HasShippingAddress { |
| 6 | /** |
| 7 | * Always set discount as object. |
| 8 | * |
| 9 | * @param array|object $value Value to set. |
| 10 | * @return $this |
| 11 | */ |
| 12 | protected function setShippingAddressAttribute( $value ) { |
| 13 | // force either string or object. |
| 14 | $this->attributes['shipping_address'] = is_string( $value ) ? $value : (object) $value; |
| 15 | return $this; |
| 16 | } |
| 17 | |
| 18 | /** |
| 19 | * Get the shipping address attribute |
| 20 | * |
| 21 | * @return string|null The shipping address. |
| 22 | */ |
| 23 | public function getShippingAddressDisplayAttribute() { |
| 24 | return $this->shipping_address->formatted_string ?? null; |
| 25 | } |
| 26 | } |
| 27 |