'boolean', 'ativo' => 'boolean' ]; protected $fillable = [ 'infraestrutura_id', 'principal', 'nome', 'telefone', 'ativo', 'endereco_id' ]; protected $hidden = [ 'created_at', 'created_lotacao_id', 'created_centro_custo_id', 'updated_at', 'updated_lotacao_id', 'updated_centro_custo_id', 'deleted_at', 'deleted_lotacao_id', 'deleted_centro_custo_id', 'unidade_id', 'endereco_id', ]; protected $with = [ 'endereco' ]; public function parametrizacaoExameImagem() { return $this->hasOne(Parametrizacao::class); } public function jornadaExameImagem() { return $this->hasMany(Jornada::class); } public function cotaPrestadorExameImagem() { return $this->hasOne(CotaPrestador::class); } public function unidade() { return $this->belongsTo(Unidade::class); } public function infraestrutura() { return $this->belongsTo(Infraestrutura::class); } public function exameLaboratorialUnidade() { return $this->hasOne(ExameLaboratorialUnidade::class); } public function exameLaboratorialUnidadeSolicitanteExame() { return $this->hasOne(UnidadeSolicitanteExame::class); } public function agendamentosExameImagem() { return $this->hasOne(Agendamento::class); } public function exameLaboratorialUnidadeCotas() { return $this->hasOne(Cota::class); } public function endereco() { return $this->belongsTo(Endereco::class); } public function centrosCusto() { return $this->hasMany(CentroCusto::class); } public function lotacoes() { return $this->hasMany(Lotacao::class); } public function ambulatorioParametrizacaoJornadaInfraestrutura() { return $this->hasOne(AmbulatorioParametrizacaoInfraestrutura::class); } public function getNomeAttribute($nome) { return $this->principal ? $this->unidade->nome_fantasia : $nome; } public function getIsAllowedToDeleteAttribute() { return $this->hasNoOne([ 'centrosCusto', 'lotacoes', ]); } }