mardi 22 novembre 2016

laravel mysql query joining two tables

I have two tables

Categories id category

Products id Categories and product details

I need to get join the both categories and get the product details according to the category id please help to build the query in laravel

I tried this but didn't work

$shares = \DB::table('products')
        ->join('categories', 'categories.category', '=', 'products.category')
        ->select('*')
        ->where('categories.id', '=', $id)
        ->get();

im getting an error which is

Cannot use object of type stdClass as array



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire