mirror of
https://github.com/kevin-DL/LaravelShoppingcart.git
synced 2026-01-24 07:55:35 +00:00
Update CanBeBought.php
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Gloudemans\Shoppingcart;
|
namespace Gloudemans\Shoppingcart;
|
||||||
|
|
||||||
|
use Gloudemans\Shoppingcart\CartItemOptions;
|
||||||
use Money\Money;
|
use Money\Money;
|
||||||
use Money\Currency;
|
use Money\Currency;
|
||||||
|
|
||||||
@@ -12,7 +13,7 @@ trait CanBeBought
|
|||||||
*
|
*
|
||||||
* @return int|string
|
* @return int|string
|
||||||
*/
|
*/
|
||||||
public function getBuyableIdentifier()
|
public function getBuyableIdentifier(CartItemOptions $options)
|
||||||
{
|
{
|
||||||
return method_exists($this, 'getKey') ? $this->getKey() : $this->id;
|
return method_exists($this, 'getKey') ? $this->getKey() : $this->id;
|
||||||
}
|
}
|
||||||
@@ -20,7 +21,7 @@ trait CanBeBought
|
|||||||
/**
|
/**
|
||||||
* Get the name, title or description of the Buyable item.
|
* Get the name, title or description of the Buyable item.
|
||||||
*/
|
*/
|
||||||
public function getBuyableDescription(): ?string
|
public function getBuyableDescription(CartItemOptions $options): ?string
|
||||||
{
|
{
|
||||||
if (($name = $this->getAttribute('name'))) {
|
if (($name = $this->getAttribute('name'))) {
|
||||||
return $name;
|
return $name;
|
||||||
@@ -36,7 +37,7 @@ trait CanBeBought
|
|||||||
/**
|
/**
|
||||||
* Get the price of the Buyable item.
|
* Get the price of the Buyable item.
|
||||||
*/
|
*/
|
||||||
public function getBuyablePrice(): Money
|
public function getBuyablePrice(CartItemOptions $options): Money
|
||||||
{
|
{
|
||||||
if (($price = $this->getAttribute('price')) && ($currency = $this->getAttribute('currency'))) {
|
if (($price = $this->getAttribute('price')) && ($currency = $this->getAttribute('currency'))) {
|
||||||
return new Money($price, new Currency($currency));
|
return new Money($price, new Currency($currency));
|
||||||
@@ -46,7 +47,7 @@ trait CanBeBought
|
|||||||
/**
|
/**
|
||||||
* Get the weight of the Buyable item.
|
* Get the weight of the Buyable item.
|
||||||
*/
|
*/
|
||||||
public function getBuyableWeight(): int
|
public function getBuyableWeight(CartItemOptions $options): int
|
||||||
{
|
{
|
||||||
if (($weight = $this->getAttribute('weight'))) {
|
if (($weight = $this->getAttribute('weight'))) {
|
||||||
return $weight;
|
return $weight;
|
||||||
|
|||||||
Reference in New Issue
Block a user