Пример #1
0
 public function updateCartAjax(Request $request)
 {
     $dish_id = $request->input('dish_id');
     $number = $request->input('number');
     $rowids = Cart::search(array('id' => $dish_id));
     foreach ($rowids as $key => $value) {
         Cart::update($value, array('qty' => $number));
     }
     return Response::json(array('success' => TRUE));
 }
Пример #2
0
 public function addToCart($bookid)
 {
     if (Cart::search(array('id' => $bookid))) {
         \Session::flash('message', 'Already added to Cart');
         \Session::flash('type', 'warning');
     } else {
         $books = \App\Books::where('bookid', $bookid)->where('available', 1)->first();
         Cart::add($books->bookid, $books->bookname, 1, $books->price, array('imageurl' => $books->imageurl));
         session([$bookid => $books]);
         \Session::flash('message', 'Added to Cart!');
         \Session::flash('type', 'success');
     }
     return redirect('/books/' . $bookid);
 }