61 lines
1.4 KiB
PHP
61 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Models\ExameLaboratorial\Parametrizacao;
|
|
|
|
use App\Models\Cadastro\Estabelecimento\Infraestrutura;
|
|
use App\Models\Cadastro\Estabelecimento\Unidade as EstabelecimentoUnidade;
|
|
use App\Models\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class Unidade extends Model
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $table = 'exame_laboratorial_parametrizacao_unidade';
|
|
|
|
protected $casts = [
|
|
'unidade_coleta' => 'boolean',
|
|
'laboratorio' => 'boolean'
|
|
];
|
|
|
|
protected $fillable = [
|
|
'unidade_id',
|
|
'unidade_coleta',
|
|
'infraestrutura_id',
|
|
'laboratorio',
|
|
'laboratorio_padrao_infraestrutura_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',
|
|
];
|
|
|
|
public function unidade()
|
|
{
|
|
return $this->belongsTo(EstabelecimentoUnidade::class);
|
|
}
|
|
|
|
public function infraestrutura()
|
|
{
|
|
return $this->belongsTo(Infraestrutura::class);
|
|
}
|
|
|
|
public function getIsAllowedToDeleteAttribute()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function laboratorioPadraoInfraestrutura()
|
|
{
|
|
return $this->belongsTo(Infraestrutura::class, 'laboratorio_padrao_infraestrutura_id');
|
|
}
|
|
}
|