Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Http\Controllers;
- use App\Hotel;
- use Illuminate\Http\Request;
- use Gloudemans\Shoppingcart\Facades\Cart;
- class ShoppingCartController extends Controller
- {
- public function getCart()
- {
- $cart = Cart::content();
- return view('reservation.shopping-cart', [
- 'cart' => $cart,
- ]);
- }
- public function postCart(Request $request, $id)
- {
- $hotel = Hotel::find($id);
- $cart = Cart::add($hotel->id, $hotel->name, 1, 9.99);
- $request->session()->put('cart', $cart);
- return $this->getCart();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment