Update CartItemModel.php

This commit is contained in:
Patrick
2022-02-08 23:38:09 +01:00
committed by GitHub
parent f5a998cfc6
commit a7a4384c73

View File

@@ -45,4 +45,15 @@ class CartItemModel extends Model
{
return $this->belongsTo(CartModel::class, 'cart_id');
}
/**
* This will is the price of the CartItem as Money
*/
public function price(): Attribute
{
return new Attribute(
get: fn (int $value) => new Money($value),
set: fn (Money $value) => $value,
);
}
}