This commit is contained in:
65
api/app/Models/Regulacao/SolicitacaoItemHistorico.php
Normal file
65
api/app/Models/Regulacao/SolicitacaoItemHistorico.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Regulacao;
|
||||
|
||||
use App\Models\Cadastro\Especialidade;
|
||||
use App\Models\Model;
|
||||
use App\Models\Parametrizacao\Exame\Exame;
|
||||
use App\Models\Parametrizacao\ProcedimentoCirurgico;
|
||||
|
||||
class SolicitacaoItemHistorico extends Model
|
||||
{
|
||||
protected $table = 'regulacao_solicitacao_item_historico';
|
||||
|
||||
protected $fillable = [
|
||||
'solicitacao_historico_id',
|
||||
'exame_id',
|
||||
'procedimento_cirurgico_id',
|
||||
'especialidade_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function solicitacaoHistorico()
|
||||
{
|
||||
return $this->belongsTo(SolicitacaoHistorico::class);
|
||||
}
|
||||
|
||||
public function exame()
|
||||
{
|
||||
return $this->belongsTo(Exame::class);
|
||||
}
|
||||
|
||||
public function procedimentoCirurgico()
|
||||
{
|
||||
return $this->belongsTo(ProcedimentoCirurgico::class);
|
||||
}
|
||||
|
||||
public function especialidade()
|
||||
{
|
||||
return $this->belongsTo(Especialidade::class);
|
||||
}
|
||||
|
||||
public function getOrigemAttribute()
|
||||
{
|
||||
if (!is_null($this->exame_id)) {
|
||||
|
||||
return 'exame';
|
||||
}
|
||||
else if (!is_null($this->procedimento_cirurgico_id)) {
|
||||
|
||||
return 'procedimento_cirurgico';
|
||||
}
|
||||
else if (!is_null($this->especialidade_id)) {
|
||||
|
||||
return 'especialidade';
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user