How can I write queries for multiple tables e.g
"select items.id, items.name, sum(qty) as qty from dispatch_main
inner join dispatch_detail on dispatch_main.id = dispatch_detail.id
inner join items on items.id = dispatch_detail.item_id
left outer join customers on dispatch_detail.customer = customers.id
where dispatch_main.entry_type in ('Purchase','Return','Confirmed') and
dispatch_main.to_=$location and items.for_customer in ($types)
group by dispatch_detail.item_id
order by items.id
";
OR
"select items.id, items.name, sum(qty) as qty from dispatch_main
inner join dispatch_detail on dispatch_main.id = dispatch_detail.id
inner join items on items.id = dispatch_detail.item_id
left outer join customers on dispatch_detail.customer = customers.id
where dispatch_main.entry_type in ('Dispatch','Confirmed') and
dispatch_main.from_=$location and items.for_customer in ($types)
group by dispatch_detail.item_id
order by items.id
"
in laravel 5.4? DB::statement can run this type of queries? If i write same type of query in DB::statement('');