This commit is contained in:
97
api/app/Models/Regulacao/ParametrizacaoRegulador.php
Normal file
97
api/app/Models/Regulacao/ParametrizacaoRegulador.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Regulacao;
|
||||
|
||||
use App\Models\Cadastro\Especialidade;
|
||||
use App\Models\Cadastro\Estabelecimento\Infraestrutura;
|
||||
use App\Models\Model;
|
||||
use App\Models\Parametrizacao\Exame\Exame;
|
||||
use App\Models\Parametrizacao\ProcedimentoCirurgico;
|
||||
|
||||
class ParametrizacaoRegulador extends Model
|
||||
{
|
||||
protected $table = 'regulacao_parametrizacao_regulador';
|
||||
|
||||
protected $casts = [
|
||||
'solicitante_controla_protocolo_fechamento' => 'boolean',
|
||||
'ativo' => 'boolean',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'infraestrutura_id',
|
||||
'tipo_id',
|
||||
'solicitante_controla_protocolo_fechamento',
|
||||
'ativo'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function infraestrutura()
|
||||
{
|
||||
return $this->belongsTo(Infraestrutura::class);
|
||||
}
|
||||
|
||||
public function tipo()
|
||||
{
|
||||
return $this->belongsTo(ParametrizacaoReguladorTipo::class);
|
||||
}
|
||||
|
||||
public function exames()
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
Exame::class,
|
||||
'regulacao_parametrizacao_regulador_exame',
|
||||
'regulador_id',
|
||||
'exame_id'
|
||||
)
|
||||
->using(ParametrizacaoReguladorExame::class)
|
||||
->as('pivotReguladorExame')
|
||||
->withPivot(['ativo'])
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function procedimentosCirurgicos()
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
ProcedimentoCirurgico::class,
|
||||
'regulacao_parametrizacao_regulador_procedimento_cirurgico',
|
||||
'regulador_id',
|
||||
'procedimento_cirurgico_id'
|
||||
)
|
||||
->using(ParametrizacaoReguladorProcedimentoCirurgico::class)
|
||||
->as('pivotprocedimentoCirurgico')
|
||||
->withPivot(['ativo'])
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function especialidades()
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
Especialidade::class,
|
||||
'regulacao_parametrizacao_regulador_especialidade',
|
||||
'regulador_id',
|
||||
'especialidade_id'
|
||||
)
|
||||
->using(ParametrizacaoReguladorEspecialidade::class)
|
||||
->as('pivotReguladorEspecialidade')
|
||||
->withPivot(['ativo'])
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function reguladorSolicitantes()
|
||||
{
|
||||
return $this->hasMany(ParametrizacaoSolicitanteRegulador::class, 'regulador_id');
|
||||
}
|
||||
|
||||
public function solicitacoes()
|
||||
{
|
||||
return $this->hasMany(Solicitacao::class, 'regulador_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user