49 lines
1023 B
PHP
49 lines
1023 B
PHP
<?php
|
|
|
|
namespace App\Models\Cadastro\Localizacao;
|
|
|
|
use App\Models\ExameImagem\Agendamento\Agendamento;
|
|
use App\Models\Model;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class Bairro extends Model
|
|
{
|
|
use HasFactory, SoftDeletes;
|
|
|
|
protected $table = 'cadastro_bairro';
|
|
|
|
protected $fillable = [
|
|
'nome'
|
|
];
|
|
|
|
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',
|
|
];
|
|
|
|
public function logradouros()
|
|
{
|
|
return $this->hasMany(Logradouro::class);
|
|
}
|
|
|
|
public function agendamentosExameImagem()
|
|
{
|
|
return $this->hasMany(Agendamento::class);
|
|
}
|
|
|
|
public function getIsAllowedToDeleteAttribute()
|
|
{
|
|
return $this->hasNoOne([
|
|
'logradouros'
|
|
]);
|
|
}
|
|
}
|