public function getByCiudad($ciudad) { $central = Central::whereHas('ciudad', function ($query) use($ciudad) { return $query->where('nombre', $ciudad); })->first(); $central->ciudad->load('departamento'); return $central; }