90 lines
2.4 KiB
PHP
90 lines
2.4 KiB
PHP
<?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 ParametrizacaoDivulgacaoRegulador extends Model
|
|
{
|
|
protected $table = 'regulacao_parametrizacao_divulgacao_regulador';
|
|
|
|
protected $casts = [
|
|
'ativo' => 'boolean',
|
|
];
|
|
|
|
protected $fillable = [
|
|
'regulacao_parametrizacao_regulador_id',
|
|
'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 exames()
|
|
{
|
|
return $this->belongsToMany(
|
|
Exame::class,
|
|
'regulacao_parametrizacao_divulgacao_regulador_exame',
|
|
'regulador_id',
|
|
'exame_id'
|
|
)
|
|
->using(ParametrizacaoReguladorExame::class)
|
|
->as('pivotReguladorExame')
|
|
->withPivot(['ativo'])
|
|
->withTimestamps();
|
|
}
|
|
|
|
public function procedimentosCirurgicos()
|
|
{
|
|
return $this->belongsToMany(
|
|
ProcedimentoCirurgico::class,
|
|
'regulacao_parametrizacao_divulgacao_regulador_cirurgico',
|
|
'regulador_id',
|
|
'procedimento_cirurgico_id'
|
|
)
|
|
->using(ParametrizacaoReguladorProcedimentoCirurgico::class)
|
|
->as('pivotprocedimentoCirurgico')
|
|
->withPivot(['ativo'])
|
|
->withTimestamps();
|
|
}
|
|
|
|
public function especialidades()
|
|
{
|
|
return $this->belongsToMany(
|
|
Especialidade::class,
|
|
'regulacao_parametrizacao_divulgacao_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');
|
|
}
|
|
}
|