Left Join Query in Laravel 5

0

The leftJoin method has the same signature as the join method. When I fetch all columns from the get-go, the query takes too load to complete (around 5 secs on 350k rows), whereas with a left join that’s cut into only half a second.

Let’s create a leftJoin method in laravel 5

$salehistory = DB::table('sale_history')
               ->leftJoin('sale_detail', 'sale_history.id', '=', 'sale_detail.sale_id')
               ->get();