This commit is contained in:
64
api/app/Models/Cadastro/Localizacao/Domicilio.php
Normal file
64
api/app/Models/Cadastro/Localizacao/Domicilio.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Cadastro\Localizacao;
|
||||
|
||||
use App\Models\AtencaoBasica\CadastroDomiciliar\CadastroDomiciliar;
|
||||
use App\Models\Cadastro\Localizacao\DomicilioInformacaoResidencial;
|
||||
use App\Models\Cadastro\SujeitoAtencao\Cidadao;
|
||||
use App\Models\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Domicilio extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'cadastro_domicilio';
|
||||
|
||||
protected $fillable = [
|
||||
'endereco_id'
|
||||
];
|
||||
|
||||
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',
|
||||
'endereco_id'
|
||||
];
|
||||
|
||||
protected $with = [
|
||||
'endereco'
|
||||
];
|
||||
|
||||
public function endereco()
|
||||
{
|
||||
return $this->belongsTo(Endereco::class);
|
||||
}
|
||||
|
||||
public function cidadaos()
|
||||
{
|
||||
return $this->hasMany(Cidadao::class);
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return $this->hasNoOne([
|
||||
'cidadaos',
|
||||
]);
|
||||
}
|
||||
|
||||
public function cadastroDomiciliar()
|
||||
{
|
||||
return $this->hasOne(CadastroDomiciliar::class);
|
||||
}
|
||||
|
||||
public function informacaoResidencial()
|
||||
{
|
||||
return $this->hasOne(DomicilioInformacaoResidencial::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user