Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
daVitekPL committed Jul 23, 2024
1 parent ccf9fd6 commit ae1386c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Models/CartItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function cart(): BelongsTo
return $this->belongsTo(Cart::class);
}

public function getSubtotalAttribute(): int
public function getSubtotalAttribute(): float
{
return parent::getSubtotalAttribute() - $this->discountSubtotal;
}
Expand Down
9 changes: 9 additions & 0 deletions src/Models/CouponCategory.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ class CouponCategory extends Pivot
{
use HasTimestamps;

/**
* @var array<int, string>
*/
public $guarded = ['id'];

protected $table = 'coupons_categories';
Expand All @@ -40,11 +43,17 @@ class CouponCategory extends Pivot
'excluded' => 'bool'
];

/**
* @return BelongsTo<Coupon, self>
*/
public function coupon(): BelongsTo
{
return $this->belongsTo(Coupon::class);
}

/**
* @return BelongsTo<Category, self>
*/
public function category(): BelongsTo
{
return $this->belongsTo(Category::class);
Expand Down
2 changes: 1 addition & 1 deletion src/Services/Contracts/CouponServiceContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function cartContainsItemsIncludedInCoupon(Coupon $coupon, Cart $cart): b
/**
* @param Coupon $coupon
* @param Cart $cart
* @return Collection<int, CartItem>
* @return Collection<int, \Treestoneit\ShoppingCart\Models\CartItem|CartItem>
*/
public function cartItemsIncludedInCoupon(Coupon $coupon, Cart $cart): Collection;
public function cartItemIsIncludedInCoupon(Coupon $coupon, CartItem $item): bool;
Expand Down
2 changes: 1 addition & 1 deletion src/Services/CouponService.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public function cartContainsItemsIncludedInCoupon(Coupon $coupon, Cart $cart): b
/**
* @param Coupon $coupon
* @param Cart $cart
* @return Collection<int, CartItem>
* @return Collection<int, CartItem|\EscolaLms\Vouchers\Models\CartItem>
*/
public function cartItemsIncludedInCoupon(Coupon $coupon, Cart $cart): Collection
{
Expand Down

0 comments on commit ae1386c

Please sign in to comment.