This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\ProntoAtendimento\Atendimento\ExameImagem;
|
||||
|
||||
use App\Models\Model;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Atendimento;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Medico\DeclaracaoComparecimento;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Observacao;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Procedimento;
|
||||
use App\Models\ProntoAtendimento\PedidoExame\Item;
|
||||
use App\Models\ProntoAtendimento\PedidoExame\Laudo;
|
||||
use App\Models\ProntoAtendimento\PedidoExame\PedidoExame;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class AtendimentoExameImagem extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'pronto_atendimento_atendimento_exame_imagem';
|
||||
|
||||
protected $casts = [
|
||||
'is_observacao' => 'boolean',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'atendimento_id',
|
||||
'is_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 atendimento()
|
||||
{
|
||||
return $this->belongsTo(Atendimento::class);
|
||||
}
|
||||
|
||||
public function observacao()
|
||||
{
|
||||
return $this->hasOne(Observacao::class, 'exame_imagem_id');
|
||||
}
|
||||
|
||||
public function procedimentos()
|
||||
{
|
||||
return $this->hasMany(Procedimento::class, 'exame_imagem_id');
|
||||
}
|
||||
|
||||
public function pedidosExames()
|
||||
{
|
||||
return $this->hasMany(PedidoExame::class, 'exame_imagem_id');
|
||||
}
|
||||
|
||||
public function pedidoExameItems()
|
||||
{
|
||||
return $this->hasMany(Item::class, 'exame_imagem_id');
|
||||
}
|
||||
|
||||
public function pedidoExameLaudos()
|
||||
{
|
||||
return $this->hasMany(Laudo::class, 'exame_imagem_id');
|
||||
}
|
||||
|
||||
public function declaracoesComparecimento()
|
||||
{
|
||||
return $this->hasMany(DeclaracaoComparecimento::class);
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return $this->hasNoOne([
|
||||
'observacao',
|
||||
'pedidosExames',
|
||||
'pedidoExameItems',
|
||||
'pedidoExameLaudos'
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user