Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Laravel - Query Builder Raw Query selectRaw

 $totalUsers = MyInventoryModel::selectRaw('pos_inventory.id as pos_inventory_id,pos_products.*,pos_products.product_name as product_name,pos_inventory.reorder_point,pos_inventory.reorder_qty,pos_inventory.current_stock,
                       pos_inventory.variant_id,pos_products.product_sku,pos_product_variants.combination_names,pos_product_variants.sku,pos_outlets.*,pos_roles.*')
                ->leftJoin('pos_products', 'pos_inventory.product_id', '=', 'pos_products.id')
                ->leftJoin('pos_product_variants', 'pos_inventory.product_id', '=', 'pos_product_variants.id')
                ->leftjoin('pos_outlets', 'pos_inventory.outlet_id', '=', 'pos_outlets.id')
                ->leftjoin('pos_roles', 'pos_outlets.store_id', '=', 'pos_roles.store_id')
                ->where('outlet_id', $item->outlet_id)
                ->groupBy('pos_inventory.product_id')
                ->get();
 
PREVIOUS NEXT
Tagged: #Laravel #Query #Builder #Raw #Query #selectRaw
ADD COMMENT
Topic
Name
4+1 =