app/Http/Controllers/ProductController.php
/**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
Display a listing of the resource.
@return \Illuminate\Http\Response
Display a listing of the resource . @return \ Illuminate \ Http \ Response
public function index()
    {
        $products=Product::all();
        $products=Product::paginate(12);
        $categorias=Categorie::all();
      if (session('carrito')) {
           $var=session('carrito');
            foreach ($var as $id) {
                $producto=Product::find($id);    
                $productos[]=$producto;
            }
        }
        return view('shop.index', compact('products',  'categorias', 'productos'));
    }
public function index ( ) { $ products = Product :: all ( ) ; $ products = Product :: paginate ( 12 ) ; $ categorias = Categorie :: all ( ) ; if ( session ( 'carrito' ) ) { $ var = session ( 'carrito' ) ; foreach ( $ var as $ id ) { $ producto = Product :: find ( $ id ) ; $ productos [ ] = $ producto ; } } return view ( 'shop.index' , compact ( 'products' , 'categorias' , 'productos' ) ) ; }
Display a listing of the resource.
Display a listing of the resource .
// 'urlImage',