1
I got the next thing:
$consulta = Dealer::find(1);
No Model
# Serviços
public function dealer_servicos(){
return $this->hasMany('App\DealerService', 'id_concessionaria');
}
So if I do:
@foreach($consulta->dealer_servicos as $value => $res)
{!! $res->servico !!}
@endforeach
Brings me all the services that the dealership HAS.
It has as I use the same methodology to bring the services that the concessionaire HAS NOT ? That is, to simulate the LEFT OUTER JOIN
.
I need all the records in the same query.
It has, if you create a table of all the services that the dealership should have and then select all those items and remove the ones that the dealership already has.
– Reginaldo Rigo
That already exists, my son.
– Diego Souza
Possible duplicate of How to get records from a table when there is no relationship with another table in Laravel?
– Wallace Maxters