-
-
Save devalexandre/ac1f6410a434000f73f1fc760a55970f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Created by PhpStorm. | |
* User: alexandre | |
* Date: 13/11/17 | |
* Time: 09:13 | |
*/ | |
namespace Indev\Shopcart\Controllers; | |
use Backend\Classes\Controller; | |
use Gloudemans\Shoppingcart\Facades\Cart; | |
use Indev\Shopcart\Models\Product; | |
class ShopcartController extends Controller | |
{ | |
public function add($id,$qty){ | |
$product = Product::find($id); | |
$cartItem = Cart::add($product->id,$product->name,$qty,$product->price); | |
Cart::associate($cartItem->rowId, '\Indev\Shopcart\Models\Product'); | |
} | |
public function update($rowId,$qty){ | |
Cart::update($rowId,$qty); | |
return Cart::content(); | |
} | |
public function remove($rowId){ | |
Cart::remove($rowId); | |
return Cart::content(); | |
} | |
public function getList () { | |
return Cart::content(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment