Update CartItem.php

Fix fatal error caused by instantiating a null associatedModel.
This commit is contained in:
John Markese
2017-08-22 10:29:39 -05:00
committed by GitHub
parent a0d2905d7a
commit 803703d170

View File

@@ -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);
}