mercredi 12 septembre 2018

Eloquent: Using Model::where + with not displaying data

Im trying to create a query using Products Model (refers to Product Table) with Photo Model / Table, Features and locations.

My idea is to filter results of table products in order to display only the information of the current logged user.

This is the query:

        $product = Product::where('companyId', '=', Auth::user()->companyId)
->with(['photos','features','locs']);

For some reason I cannot find why when I include

Product::where('companyId', '=', Auth::user()->companyId)

the query stop working.

its possible to use Products:where(condition) + wish?

thanks in advance.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2Ofap90
via IFTTT

Aucun commentaire:

Enregistrer un commentaire