belongsTo(Municipio::class); } public function bairro() { return $this->belongsTo(Bairro::class); } public function tipo() { return $this->belongsTo(LogradouroTipo::class); } public function enderecos() { return $this->hasMany(Endereco::class); } public function agendamentosExameImagem() { return $this->hasMany(Agendamento::class); } public function getTipoNomeAttribute() { return "{$this->tipo->descricao} {$this->nome}"; } public function getIsAllowedToDeleteAttribute() { return $this->hasNoOne([ 'enderecos' ]); } }