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

49 lines
1.0 KiB
PHP

<?php
namespace App\Models\Sigtap;
use App\Models\ProntoAtendimento\Atendimento\RaatParecerMedico;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class Cid extends Model
{
protected $connection = 'sigtap';
protected $table = 'cid';
protected $casts = [
'is_ativo' => 'boolean'
];
protected $fillable = [
'codigo',
'nome',
'agravo',
'sexo',
'estado',
'campos_irradiados',
'is_ativo'
];
protected $hidden = [
'created_at',
'updated_at'
];
public function __construct() {
$this->table = DB::connection($this->connection)->getDatabaseName() . '.' . $this->table;
}
public function pareceresMedico()
{
return $this->hasMany(RaatParecerMedico::class);
}
public function procedimentos()
{
return $this->belongsToMany(Procedimento::class, 'procedimento_cid')->as('procedimentoCid')
->withPivot('principal', 'competencia_id')->withTimestamps();
}
}