feat: Implement order and invoice management, enhance addon features, and remove the 'Type' module.
This commit is contained in:
@@ -64,4 +64,22 @@ class Cart extends Model
|
||||
{
|
||||
return $this->belongsTo(ProductPricings::class, 'product_pricing_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Relationship: Cart has many addons
|
||||
*/
|
||||
public function addons()
|
||||
{
|
||||
return $this->hasMany(CartAddon::class, 'cart_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get total price including addons
|
||||
*/
|
||||
public function getTotalPriceAttribute()
|
||||
{
|
||||
$basePrice = $this->price * $this->quantity;
|
||||
$addonsPrice = $this->addons->sum('price');
|
||||
return $basePrice + $addonsPrice;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user