Join Query in Laravel 5

The query builder may also be used to write join statements. To perform a basic “inner join”, you may use the join method on a query builder instance. The first argument passed to the join method is the name of the table you need to join to, while the remaining arguments specify the column constraints for the join. Of course, as you can see, you can join to multiple tables in a single query.

$data['get_cartlist'] = DB::table('cart')
    ->join('cart_products', 'cart.crt_id', '=', 'cart_products.cart_id')
    ->join('diamond_master', 'cart_products.loat_id', '=', 'diamond_master.Loat_NO')
    ->select('diamond_master.*','cart_products.crt_p_id', 'cart_products.loat_id',
'cart_products.add_date',' as diamondid')
		->orderBy('cart_products.add_date', 'desc')
return view('front.checkout',$data);

Leave a Reply

Your email address will not be published. Required fields are marked *