mercredi 30 décembre 2015

Blade not displaying model values from the database

I am trying to display the list of products for a user, and to my surprise this does not display it on the page, though, it is inserted into the database, what could be wrong?

public function index()
        {
            $listProducts = Product::where('user_id', '=', Auth::user()->id)->orderBy('productname', 'desc');
            return view('product.index')
            ->with('products', $listProducts);
        }

Blade file:

@if(Auth::check())
                        @foreach($products as $product)

                                <TR><TD>{!! $product->companyname !!}</TD><TD>{!! $product->productname !!}</TR>

                        @endforeach
                    @endif



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire