Files
Antonio Lopes dos Santos afec302c3e
All checks were successful
build-api-image / build (push) Successful in 51s
init commit
2026-08-04 16:52:02 -03:00

85 lines
1.9 KiB
PHP

<?php
namespace App\Models\ExameLaboratorial\Parametrizacao;
use App\Models\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use App\Models\Cadastro\Estabelecimento\Unidade;
use Dyrynda\Database\Support\CascadeSoftDeletes;
use App\Models\Cadastro\Estabelecimento\Infraestrutura;
use App\Models\ExameLaboratorial\Parametrizacao\CotaExame;
use App\Models\ExameLaboratorial\Parametrizacao\CotaUnidadeSolicitante;
class Cota extends Model
{
use SoftDeletes, CascadeSoftDeletes;
protected $table = 'exame_laboratorial_parametrizacao_cota';
protected $cascadeDeletes = [
'cotaUnidadeSolicitante', 'cotaExame'
];
protected $fillable = [
'id',
'unidade_id',
'infraestrutura_id',
'unidade_tipo_id',
'cota_tipo_id',
'inicio',
'fim',
'cota_quantidade',
'cota_valor',
'unidade_solicitante_id',
'unidade_solicitante_infraestrutura_id',
'observacao'
];
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(Unidade::class);
}
public function unidadeSolicitante()
{
return $this->belongsTo(Unidade::class);
}
public function infraestrutura()
{
return $this->belongsTo(Infraestrutura::class);
}
public function unidadeSolicitanteInfraestrutura()
{
return $this->belongsTo(Infraestrutura::class);
}
public function cotaUnidadeSolicitante()
{
return $this->hasMany(CotaUnidadeSolicitante::class);
}
public function cotaExame()
{
return $this->hasMany(CotaExame::class);
}
public function getIsAllowedToDeleteAttribute()
{
return true;
}
}