This commit is contained in:
48
api/app/Models/Sigtap/Cid.php
Normal file
48
api/app/Models/Sigtap/Cid.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user