I need help with this SQL
of Laravel
:
$process = $db->table('processo')->where('nrprocesso',$id)
->leftJoin('viatransporte', function($viatransporte){
$viatransporte->on('processo.idviatransporte', '=', 'viatransporte.idviatransporte')
->whereNotNull('processo.idviatransporte'); })
->leftJoin('area', function($area){
$area->on('processo.idarea', '=', 'area.idarea')
->whereNotNull('processo.idarea'); })
->leftJoin('moeda', function($moeda){
$moeda->on('processo.idmoedamle', '=', 'moeda.idmoeda')
->whereNotNull('processo.idmoedamle'); });
This join needs to return two records that are in the database, but returns only one record, the first, the others do not. How do I return an array with all records?
->leftJoin('processodocinstrucaodespacho', function($processodocinstrucaodespacho){
$processodocinstrucaodespacho->on('processo.idprocesso',
'=', 'processodocinstrucaodespacho.idprocesso')
->where('processodocinstrucaodespacho.iddocinstrucaodespacho', '=', 1); })
->select('processo.*', 'area.aparea',
'viatransporte.nmviatransporte', 'moeda.sigla',
'processodocinstrucaodespacho.nrdocinstrucaodespacho')
->get();