From bbf070318108fabaae61562c086c33f46c03fea0 Mon Sep 17 00:00:00 2001 From: = Date: Sun, 17 Jan 2021 22:06:16 +0100 Subject: [PATCH] Fixing InvalidArgumentException when adding buyable models to Cart on newer Laravel Versions. --- src/CanBeBought.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/CanBeBought.php b/src/CanBeBought.php index 62a08a3..b1c28b8 100644 --- a/src/CanBeBought.php +++ b/src/CanBeBought.php @@ -21,15 +21,15 @@ trait CanBeBought */ public function getBuyableDescription($options = null) { - if (property_exists($this, 'name')) { + if (isset($this->name)) { return $this->name; } - if (property_exists($this, 'title')) { + if (isset($this->title)) { return $this->title; } - if (property_exists($this, 'description')) { + if (isset($this->description)) { return $this->description; } } @@ -41,7 +41,7 @@ trait CanBeBought */ public function getBuyablePrice($options = null) { - if (property_exists($this, 'price')) { + if (isset($this->price)) { return $this->price; } } @@ -53,7 +53,7 @@ trait CanBeBought */ public function getBuyableWeight($options = null) { - if (property_exists($this, 'weight')) { + if (isset($this->weight)) { return $this->weight; }