This commit is contained in:
26
api/app/Models/Administracao/Configuracao.php
Normal file
26
api/app/Models/Administracao/Configuracao.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class Configuracao extends Model
|
||||
{
|
||||
protected $table = 'administracao_configuracao';
|
||||
|
||||
protected $fillable = [
|
||||
'bpa_intrumento_registro_padrao',
|
||||
];
|
||||
|
||||
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',
|
||||
];
|
||||
}
|
||||
25
api/app/Models/Administracao/CrudAcao.php
Normal file
25
api/app/Models/Administracao/CrudAcao.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class CrudAcao extends Model
|
||||
{
|
||||
protected $table = 'administracao_crud_acao';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function permissao()
|
||||
{
|
||||
return $this->hasMany(Permissao::class);
|
||||
}
|
||||
}
|
||||
26
api/app/Models/Administracao/EndpointAcao.php
Normal file
26
api/app/Models/Administracao/EndpointAcao.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class EndpointAcao extends Model
|
||||
{
|
||||
protected $table = 'administracao_endpoint_acao';
|
||||
|
||||
protected $fillable = [
|
||||
'permissao_id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'permissao_id',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function permissao()
|
||||
{
|
||||
return $this->belongsTo(Permissao::class);
|
||||
}
|
||||
}
|
||||
53
api/app/Models/Administracao/Funcionalidade.php
Normal file
53
api/app/Models/Administracao/Funcionalidade.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class Funcionalidade extends Model
|
||||
{
|
||||
protected $table = 'administracao_funcionalidade';
|
||||
|
||||
protected $fillable = [
|
||||
'modulo_id',
|
||||
'identificador',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'modulo_id',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'pivot',
|
||||
];
|
||||
|
||||
public function modulo()
|
||||
{
|
||||
return $this->belongsTo(Modulo::class);
|
||||
}
|
||||
|
||||
public function permissoes()
|
||||
{
|
||||
return $this->hasMany(Permissao::class);
|
||||
}
|
||||
|
||||
public function funcionalidadesSub()
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
Funcionalidade::class,
|
||||
'administracao_funcionalidade_funcionalidade_sub',
|
||||
'funcionalidade_id',
|
||||
'funcionalidade_sub_id',
|
||||
)->withTimestamps();
|
||||
}
|
||||
|
||||
public function funcionalidadesPai()
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
Funcionalidade::class,
|
||||
'administracao_funcionalidade_funcionalidade_sub',
|
||||
'funcionalidade_sub_id',
|
||||
'funcionalidade_id',
|
||||
)->withTimestamps();
|
||||
}
|
||||
}
|
||||
44
api/app/Models/Administracao/Gestor.php
Normal file
44
api/app/Models/Administracao/Gestor.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Cadastro\SujeitoAtencao\Usuario;
|
||||
use App\Models\Model;
|
||||
|
||||
class Gestor extends Model
|
||||
{
|
||||
protected $table = 'administracao_gestor';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'usuario_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function usuario()
|
||||
{
|
||||
return $this->belongsTo(Usuario::class);
|
||||
}
|
||||
|
||||
public function papeis()
|
||||
{
|
||||
return $this->belongsToMany(Papel::class, 'administracao_gestor_papel', 'gestor_id', 'papel_id')
|
||||
->using(GestorPapel::class)
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function permissoes()
|
||||
{
|
||||
return $this->belongsToMany(Permissao::class, 'administracao_gestor_permissao', 'gestor_id', 'permissao_id')
|
||||
->using(GestorPermissao::class)
|
||||
->withTimestamps();
|
||||
}
|
||||
}
|
||||
17
api/app/Models/Administracao/GestorPapel.php
Normal file
17
api/app/Models/Administracao/GestorPapel.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class GestorPapel extends Pivot
|
||||
{
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
}
|
||||
17
api/app/Models/Administracao/GestorPermissao.php
Normal file
17
api/app/Models/Administracao/GestorPermissao.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class GestorPermissao extends Pivot
|
||||
{
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
}
|
||||
20
api/app/Models/Administracao/HistoricoAcao.php
Normal file
20
api/app/Models/Administracao/HistoricoAcao.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class HistoricoAcao extends Model
|
||||
{
|
||||
protected $table = 'administracao_historico_acao';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
17
api/app/Models/Administracao/LotacaoPapel.php
Normal file
17
api/app/Models/Administracao/LotacaoPapel.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class LotacaoPapel extends Pivot
|
||||
{
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
}
|
||||
25
api/app/Models/Administracao/LotacaoPapelHistorico.php
Normal file
25
api/app/Models/Administracao/LotacaoPapelHistorico.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class LotacaoPapelHistorico extends Pivot
|
||||
{
|
||||
protected $table = 'administracao_lotacao_papel_historico';
|
||||
|
||||
protected $fillable = [
|
||||
'acao_id',
|
||||
'lotacao_id',
|
||||
'papel_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
}
|
||||
17
api/app/Models/Administracao/LotacaoPermissao.php
Normal file
17
api/app/Models/Administracao/LotacaoPermissao.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class LotacaoPermissao extends Pivot
|
||||
{
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
}
|
||||
25
api/app/Models/Administracao/LotacaoPermissaoHistorico.php
Normal file
25
api/app/Models/Administracao/LotacaoPermissaoHistorico.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class LotacaoPermissaoHistorico extends Pivot
|
||||
{
|
||||
protected $table = 'administracao_lotacao_permissao_historico';
|
||||
|
||||
protected $fillable = [
|
||||
'acao_id',
|
||||
'lotacao_id',
|
||||
'permissao_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
}
|
||||
32
api/app/Models/Administracao/Menu.php
Normal file
32
api/app/Models/Administracao/Menu.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class Menu extends Model
|
||||
{
|
||||
protected $table = 'administracao_menu';
|
||||
|
||||
protected $fillable = [
|
||||
'menu_id',
|
||||
'funcionalidade_id',
|
||||
'nome',
|
||||
'icone',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function menu()
|
||||
{
|
||||
return $this->belongsTo(Menu::class, 'id', 'menu_id');
|
||||
}
|
||||
|
||||
public function funcionalidade()
|
||||
{
|
||||
return $this->belongsTo(Funcionalidade::class);
|
||||
}
|
||||
}
|
||||
32
api/app/Models/Administracao/Modulo.php
Normal file
32
api/app/Models/Administracao/Modulo.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Cadastro\Feriado\Feriado;
|
||||
use App\Models\Model;
|
||||
|
||||
class Modulo extends Model
|
||||
{
|
||||
protected $table = 'administracao_modulo';
|
||||
|
||||
protected $fillable = [
|
||||
'identificador',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function funcionalidades()
|
||||
{
|
||||
return $this->hasMany(Funcionalidade::class);
|
||||
}
|
||||
|
||||
public function feriado()
|
||||
{
|
||||
return $this->hasMany(Feriado::class);
|
||||
}
|
||||
|
||||
}
|
||||
34
api/app/Models/Administracao/Notificacao.php
Normal file
34
api/app/Models/Administracao/Notificacao.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Cadastro\SujeitoAtencao\Lotacao;
|
||||
use App\Models\Model;
|
||||
|
||||
class Notificacao extends Model
|
||||
{
|
||||
protected $table = 'administracao_notificacao';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'tipo_id',
|
||||
'titulo',
|
||||
'mensagem',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function lotacoes()
|
||||
{
|
||||
return $this->belongsToMany(Lotacao::class, 'administracao_notificacao_lotacao', 'notificacao_id', 'lotacao_id')
|
||||
->withPivot('visualizado')
|
||||
->withTimestamps();
|
||||
}
|
||||
}
|
||||
20
api/app/Models/Administracao/NotificacaoTipo.php
Normal file
20
api/app/Models/Administracao/NotificacaoTipo.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class NotificacaoTipo extends Model
|
||||
{
|
||||
protected $table = 'administracao_notificacao_tipo';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
79
api/app/Models/Administracao/Papel.php
Normal file
79
api/app/Models/Administracao/Papel.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Cadastro\SujeitoAtencao\Lotacao;
|
||||
use App\Models\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Papel extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'administracao_papel';
|
||||
|
||||
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',
|
||||
'pivot',
|
||||
];
|
||||
|
||||
protected $with = [
|
||||
'permissoes',
|
||||
];
|
||||
|
||||
public function permissoes()
|
||||
{
|
||||
return $this
|
||||
->belongsToMany(
|
||||
Permissao::class,
|
||||
'administracao_papel_permissao',
|
||||
'papel_id',
|
||||
'permissao_id'
|
||||
)
|
||||
->using(PapelPermissao::class)
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function lotacoes()
|
||||
{
|
||||
return $this
|
||||
->belongsToMany(
|
||||
Lotacao::class,
|
||||
'administracao_lotacao_papel',
|
||||
'papel_id',
|
||||
'lotacao_id'
|
||||
)
|
||||
->using(LotacaoPapel::class)
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function gestores()
|
||||
{
|
||||
return $this
|
||||
->belongsToMany(
|
||||
Gestor::class,
|
||||
'administracao_gestor_papel',
|
||||
'papel_id',
|
||||
'gestor_id'
|
||||
)
|
||||
->using(GestorPapel::class)
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
17
api/app/Models/Administracao/PapelPermissao.php
Normal file
17
api/app/Models/Administracao/PapelPermissao.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class PapelPermissao extends Pivot
|
||||
{
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
}
|
||||
25
api/app/Models/Administracao/PapelPermissaoHistorico.php
Normal file
25
api/app/Models/Administracao/PapelPermissaoHistorico.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class PapelPermissaoHistorico extends Pivot
|
||||
{
|
||||
protected $table = 'administracao_papel_permissao_historico';
|
||||
|
||||
protected $fillable = [
|
||||
'acao_id',
|
||||
'papel_id',
|
||||
'permissao_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
}
|
||||
77
api/app/Models/Administracao/Permissao.php
Normal file
77
api/app/Models/Administracao/Permissao.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Administracao;
|
||||
|
||||
use App\Models\Cadastro\SujeitoAtencao\Lotacao;
|
||||
use App\Models\Model;
|
||||
|
||||
class Permissao extends Model
|
||||
{
|
||||
protected $table = 'administracao_permissao';
|
||||
|
||||
protected $fillable = [
|
||||
'funcionalidade_id',
|
||||
'crud_acao_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'funcionalidade_id',
|
||||
'crud_acao_id',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'pivot',
|
||||
];
|
||||
|
||||
protected $with = [
|
||||
'crudAcao',
|
||||
'endpointAcoes',
|
||||
];
|
||||
|
||||
public function funcionalidade()
|
||||
{
|
||||
return $this->belongsTo(Funcionalidade::class);
|
||||
}
|
||||
|
||||
public function crudAcao()
|
||||
{
|
||||
return $this->belongsTo(CrudAcao::class);
|
||||
}
|
||||
|
||||
public function endpointAcoes()
|
||||
{
|
||||
return $this->hasMany(EndpointAcao::class);
|
||||
}
|
||||
|
||||
public function papeis()
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
Papel::class,
|
||||
'administracao_papel_permissao',
|
||||
'permissao_id',
|
||||
'papel_id'
|
||||
)->withTimestamps();
|
||||
}
|
||||
|
||||
public function lotacoes()
|
||||
{
|
||||
return $this->belongsToMany(
|
||||
Lotacao::class,
|
||||
'administracao_lotacao_permissao',
|
||||
'permissao_id',
|
||||
'lotacao_id'
|
||||
)->withTimestamps();
|
||||
}
|
||||
|
||||
public function gestores()
|
||||
{
|
||||
return $this
|
||||
->belongsToMany(
|
||||
Gestor::class,
|
||||
'administracao_gestor_permissao',
|
||||
'permissao_id',
|
||||
'gestor_id'
|
||||
)
|
||||
->using(GestorPermissao::class)
|
||||
->withTimestamps();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user