Skip to content

Commit

Permalink
Fixing item model binding and taxable from mysql not always bool (#126)
Browse files Browse the repository at this point in the history
* fixing some type hinting

* updating read me a bit

* allow user to add via item id as well as item model

* showing more of the bindings availalble

* adding the exceptiong

* removing scrutinzier,

* hotfix

* fixing and cleaning up migrations

* idea should be in global gitignore

* CS

* more cs

* adding facade back in

* fixing bad code

* fixing issue with item model , and taxbale
  • Loading branch information
lukepolo committed May 1, 2016
1 parent ad4e5a7 commit c45166e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/LaraCart.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,7 @@ public function add(
$itemModel = $itemID;

if (!$this->isItemModel($itemModel)) {
$itemModel = new $this->itemModel;
$itemModel->with($this->itemModelRelations)->find($itemID);
$itemModel = (new $this->itemModel)->with($this->itemModelRelations)->find($itemID);
}

if (empty($itemModel)) {
Expand All @@ -234,7 +233,7 @@ public function add(

$price = $itemModel[$bindings[\LukePOLO\LaraCart\CartItem::ITEM_PRICE]];
$options = $this->getItemModelOptions($itemModel, $bindings[\LukePOLO\LaraCart\CartItem::ITEM_OPTIONS]);
$taxable = $itemModel[$bindings[\LukePOLO\LaraCart\CartItem::ITEM_TAXABLE]];
$taxable = $itemModel[$bindings[\LukePOLO\LaraCart\CartItem::ITEM_TAXABLE]] ? true : false;
}

$item = $this->addItem(new CartItem(
Expand Down

0 comments on commit c45166e

Please sign in to comment.