app/Http/Controllers/Site/ProductsController.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 = DB::table('products')
        ->join('types', 'products.type_id', '=', 'types.type_id')
        ->join('sizes', 'products.size_id', '=', 'sizes.size_id')
        ->select('products.*', 'types.name as type_name', 'sizes.name as size_name')
        ->get();
        $types = DB::table('types')->get();
        $sizes = DB::table('sizes')->get();
        return view('Site.Produtos.index',[
            'products' => $products,
            'types' => $types,
            'sizes' => $sizes,
            ]);
    }
public function index ( ) { $ products = DB :: table ( 'products' ) -> join ( 'types' , 'products.type_id' , '=' , 'types.type_id' ) -> join ( 'sizes' , 'products.size_id' , '=' , 'sizes.size_id' ) -> select ( 'products.*' , 'types.name as type_name' , 'sizes.name as size_name' ) -> get ( ) ; $ types = DB :: table ( 'types' ) -> get ( ) ; $ sizes = DB :: table ( 'sizes' ) -> get ( ) ; return view ( 'Site.Produtos.index' , [ 'products' => $ products , 'types' => $ types , 'sizes' => $ sizes , ] ) ; }
Display a listing of the resource.
Display a listing of the resource .
#dd($products, $types, $sizes);