| @@ 35-46 (lines=12) @@ | ||
| 32 | * @param CartRepository $repository |
|
| 33 | * @return [type] |
|
| 34 | */ |
|
| 35 | public function applyPromotion(CartRepository $repository) |
|
| 36 | { |
|
| 37 | try { |
|
| 38 | $code = input('code'); |
|
| 39 | ||
| 40 | return $repository->applyPromotion($code); |
|
| 41 | } catch (Exception $e) { |
|
| 42 | Log::error($e->getMessage()); |
|
| 43 | ||
| 44 | abort(500, $e->getMessage()); |
|
| 45 | } |
|
| 46 | } |
|
| 47 | ||
| 48 | /** |
|
| 49 | * Determine if a cart exists or not. |
|
| @@ 126-137 (lines=12) @@ | ||
| 123 | * @param CartRepository $repository |
|
| 124 | * @return [type] |
|
| 125 | */ |
|
| 126 | public function updateItem(CartRepository $repository, $itemId) |
|
| 127 | { |
|
| 128 | try { |
|
| 129 | $quantity = input('quantity'); |
|
| 130 | ||
| 131 | return $repository->updateItem($itemId, $quantity); |
|
| 132 | } catch (Exception $e) { |
|
| 133 | Log::error($e->getMessage()); |
|
| 134 | ||
| 135 | abort(500, $e->getMessage()); |
|
| 136 | } |
|
| 137 | } |
|
| 138 | } |
|
| 139 | ||