Hi How can i generate query like this in Laravel ELoquent
SELECT expenditure_heads.name, budget_details.budget, budget_details.id FROM expenditure_heads
LEFT JOIN budget_details
ON (budget_details.expenditure_head_id = expenditure_heads.id AND budget_details.budget_id = 1)
I tried
DB::table('budget_details')
->leftJoin('expenditure_heads', function ($join) {
$join->on('budget_details.expenditure_head_id', '=', 'expenditure_heads.id');
$join->on('budget_details.budget_id','=',1);
})
->select('expenditure_heads.name','budget_details.budget')
But its not working
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire