I'm putting together a query in Laravel with optional parameters, so far so good. The problem arises that at the end of the query I charge with the relationships to the results, but these relationships also have relationships that I also want to load. How can I achieve this?
$query = NULL;
if(request('barber')===NULL ) {
$query = Atencion::select();
}
else{
$query = Atencion::where('user_id','=',request('barber'));
}
$atenciones = $query->with('usuario','cliente','detalle')->get();
return $atenciones;
that is, my relationship detail has a relation services for example, that I also want to load
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire