46 lines
817 B
PHP
46 lines
817 B
PHP
<?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';
|
|
}
|
|
}
|
|
}
|