Skip to content

Commit

Permalink
Merge pull request #13 from Itxshakiil/patch-1
Browse files Browse the repository at this point in the history
toJson return with model if available
  • Loading branch information
hardevine authored Apr 15, 2020
2 parents 1dcc4ae + 4510098 commit fe4f4c0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/CartItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,9 @@ public function toArray()
*/
public function toJson($options = 0)
{
if(isset($this->associatedModel){
return json_encode(array_merge($this->toArray(), ['model' => $this->model]), $options);
}
return json_encode($this->toArray(), $options);
}

Expand Down

0 comments on commit fe4f4c0

Please sign in to comment.