From 803703d170344640400f29ef3f5d778207801716 Mon Sep 17 00:00:00 2001 From: John Markese Date: Tue, 22 Aug 2017 10:29:39 -0500 Subject: [PATCH] Update CartItem.php Fix fatal error caused by instantiating a null associatedModel. --- src/CartItem.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CartItem.php b/src/CartItem.php index 4e2e328..64e2cf6 100644 --- a/src/CartItem.php +++ b/src/CartItem.php @@ -274,7 +274,7 @@ class CartItem implements Arrayable, Jsonable return $this->tax * $this->qty; } - if($attribute === 'model') { + if($attribute === 'model' && isset($this->associatedModel)) { return with(new $this->associatedModel)->find($this->id); }