Пример #1
0
 public function getBasked(Products $products, Slider $slider, Delivery $delivery)
 {
     if (Session::get('product')) {
         $this->data['delivery'] = $delivery->getDeliveryActive();
         $productsBasked = Session::get('product');
         $this->data['countProducts'] = collect($productsBasked);
         $productsId = '';
         $k = 0;
         foreach ($productsBasked as $id) {
             if ($k == 0) {
                 $productsId = $id['id'];
                 $k++;
             } else {
                 $productsId = $productsId . ' ,' . $id['id'];
             }
         }
         $this->data['bascedProducts'] = collect($products->getBascedProducts($productsId));
     } else {
         $this->data['bascedErrr'] = 'Корзина пуста';
     }
     $this->data['slides'] = $slider->getActive();
     $this->data['products'] = $products->getActive();
     if (\Auth::user()) {
         $this->data['name'] = \Auth::user()->name;
         $this->data['address'] = \Auth::user()->address;
         $this->data['email'] = \Auth::user()->email;
         $this->data['number'] = \Auth::user()->number;
     }
     return view('pages.cart', $this->data);
 }