/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $empresas = Empresa::with('servicios')->get(); return $empresas; }
public function getAllConductores($id) { $conductores = Empresa::with('conductores.central', 'conductores.central.ciudad', 'conductores.vehiculo')->find($id)->conductores; // foreach ($conductores as &$conductor) { // $con // if($conductor->central) { // $conductor->central->load('ciudad'); // } // } return $conductores; }