This commit is contained in:
45
api/app/Models/Cadastro/SujeitoAtencao/Sexo.php
Normal file
45
api/app/Models/Cadastro/SujeitoAtencao/Sexo.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Cadastro\SujeitoAtencao;
|
||||
|
||||
use App\Enums\Cadastro\SujeitoAtencao\Sexo as SujeitoAtencaoSexo;
|
||||
use App\Models\Model;
|
||||
|
||||
class Sexo extends Model
|
||||
{
|
||||
protected $table = 'cadastro_sexo';
|
||||
|
||||
public $incrementing = false;
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'descricao',
|
||||
'codigo_esus',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
protected $appends = [
|
||||
'identificador'
|
||||
];
|
||||
|
||||
public function cidadaos()
|
||||
{
|
||||
return $this->hasMany(Cidadao::class);
|
||||
}
|
||||
|
||||
public function getIdentificadorAttribute()
|
||||
{
|
||||
if ($this->id === SujeitoAtencaoSexo::MASCULINO) {
|
||||
|
||||
return 'M';
|
||||
}
|
||||
if ($this->id === SujeitoAtencaoSexo::FEMININO) {
|
||||
|
||||
return 'F';
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user