This commit is contained in:
48
api/app/Models/Sigtap/Ocupacao.php
Normal file
48
api/app/Models/Sigtap/Ocupacao.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Sigtap;
|
||||
|
||||
use App\Models\Cadastro\SujeitoAtencao\Lotacao;
|
||||
use App\Models\ProntoAtendimento\Atendimento\Recepcao;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Ocupacao extends Model
|
||||
{
|
||||
protected $connection = 'sigtap';
|
||||
|
||||
protected $table = 'ocupacao';
|
||||
|
||||
protected $fillable = [
|
||||
'codigo',
|
||||
'nome'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at'
|
||||
];
|
||||
|
||||
protected $appends = [
|
||||
'codigo_nome'
|
||||
];
|
||||
|
||||
public function procedimentos()
|
||||
{
|
||||
return $this->belongsToMany(Procedimento::class, 'procedimento_ocupacao');
|
||||
}
|
||||
|
||||
public function lotacoes()
|
||||
{
|
||||
return $this->hasMany(Lotacao::class);
|
||||
}
|
||||
|
||||
public function recepcoes()
|
||||
{
|
||||
return $this->hasMany(Recepcao::class);
|
||||
}
|
||||
|
||||
public function getCodigoNomeAttribute()
|
||||
{
|
||||
return "{$this->codigo} - {$this->nome}";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user