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