This commit is contained in:
69
api/app/Models/WebService/Almoxarifado/Cliente/Entrada.php
Normal file
69
api/app/Models/WebService/Almoxarifado/Cliente/Entrada.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\WebService\Almoxarifado\Cliente;
|
||||
|
||||
use App\Models\Almoxarifado\Entrada as AlmoxarifadoEntrada;
|
||||
use App\Models\Model;
|
||||
|
||||
class Entrada extends Model
|
||||
{
|
||||
protected $table = 'web_service_almoxarifado_cliente_entrada';
|
||||
|
||||
protected $casts = [
|
||||
'data_documento' => 'datetime:Y-m-d',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'conectasus_entrada_id',
|
||||
'unidade_id',
|
||||
'fornecedor_id',
|
||||
'codigo_nota',
|
||||
'documento_tipo_id',
|
||||
'data_documento',
|
||||
'numero_documento',
|
||||
'numero_pedido',
|
||||
'status_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'conectasus_entrada_id',
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'externo_created_usuario_id',
|
||||
'externo_updated_usuario_id',
|
||||
];
|
||||
|
||||
public function conectasusEntrada()
|
||||
{
|
||||
return $this->belongsTo(AlmoxarifadoEntrada::class);
|
||||
}
|
||||
|
||||
public function unidade()
|
||||
{
|
||||
return $this->belongsTo(Unidade::class);
|
||||
}
|
||||
|
||||
public function fornecedor()
|
||||
{
|
||||
return $this->belongsTo(Fornecedor::class);
|
||||
}
|
||||
|
||||
public function documentoTipo()
|
||||
{
|
||||
return $this->belongsTo(EntradaDocumentoTipo::class);
|
||||
}
|
||||
|
||||
public function status()
|
||||
{
|
||||
return $this->belongsTo(EntradaStatus::class);
|
||||
}
|
||||
|
||||
public function itens()
|
||||
{
|
||||
return $this->hasMany(EntradaItem::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\WebService\Almoxarifado\Cliente;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class EntradaDocumentoTipo extends Model
|
||||
{
|
||||
protected $table = 'web_service_almoxarifado_cliente_entrada_documento_tipo';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\WebService\Almoxarifado\Cliente;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class EntradaItem extends Model
|
||||
{
|
||||
protected $table = 'web_service_almoxarifado_cliente_entrada_item';
|
||||
|
||||
protected $casts = [
|
||||
'validade_lote' => 'datetime:Y-m-d',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'entrada_id',
|
||||
'material_id',
|
||||
'fabricante_id',
|
||||
'lote',
|
||||
'validade_lote',
|
||||
'quantidade',
|
||||
'valor_unitario',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'id',
|
||||
'entrada_id',
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'externo_created_usuario_id',
|
||||
'externo_updated_usuario_id',
|
||||
];
|
||||
|
||||
public function getValorUnitarioFormattedAttribute()
|
||||
{
|
||||
return number_format($this->valor_unitario, 6, ',', '.');
|
||||
}
|
||||
|
||||
public function entrada()
|
||||
{
|
||||
return $this->belongsTo(Entrada::class);
|
||||
}
|
||||
|
||||
public function material()
|
||||
{
|
||||
return $this->belongsTo(Material::class);
|
||||
}
|
||||
|
||||
public function fabricante()
|
||||
{
|
||||
return $this->belongsTo(Fabricante::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\WebService\Almoxarifado\Cliente;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class EntradaStatus extends Model
|
||||
{
|
||||
protected $table = 'web_service_almoxarifado_cliente_entrada_status';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\WebService\Almoxarifado\Cliente;
|
||||
|
||||
use App\Models\Cadastro\Fabricante\Fabricante as CadastroFabricante;
|
||||
use App\Models\Model;
|
||||
|
||||
class Fabricante extends Model
|
||||
{
|
||||
protected $table = 'web_service_almoxarifado_cliente_fabricante';
|
||||
|
||||
protected $fillable = [
|
||||
'conectasus_fabricante_id',
|
||||
'nome',
|
||||
'cnpj',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'externo_created_usuario_id',
|
||||
'externo_updated_usuario_id',
|
||||
];
|
||||
|
||||
public function conectasusFabricante()
|
||||
{
|
||||
return $this->belongsTo(CadastroFabricante::class);
|
||||
}
|
||||
|
||||
public function entradaItens()
|
||||
{
|
||||
return $this->hasMany(EntradaItem::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\WebService\Almoxarifado\Cliente;
|
||||
|
||||
use App\Models\Cadastro\Fornecedor\Fornecedor as CadastroFornecedor;
|
||||
use App\Models\Model;
|
||||
|
||||
class Fornecedor extends Model
|
||||
{
|
||||
protected $table = 'web_service_almoxarifado_cliente_fornecedor';
|
||||
|
||||
protected $fillable = [
|
||||
'conectasus_fornecedor_id',
|
||||
'nome',
|
||||
'cnpj',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'externo_created_usuario_id',
|
||||
'externo_updated_usuario_id',
|
||||
];
|
||||
|
||||
public function conectasusFornecedor()
|
||||
{
|
||||
return $this->belongsTo(CadastroFornecedor::class);
|
||||
}
|
||||
|
||||
public function entradas()
|
||||
{
|
||||
return $this->hasMany(Entrada::class);
|
||||
}
|
||||
}
|
||||
37
api/app/Models/WebService/Almoxarifado/Cliente/Material.php
Normal file
37
api/app/Models/WebService/Almoxarifado/Cliente/Material.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\WebService\Almoxarifado\Cliente;
|
||||
|
||||
use App\Models\Cadastro\Material\Material as CadastroMaterial;
|
||||
use App\Models\Model;
|
||||
|
||||
class Material extends Model
|
||||
{
|
||||
protected $table = 'web_service_almoxarifado_cliente_material';
|
||||
|
||||
protected $fillable = [
|
||||
'conectasus_material_id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'externo_created_usuario_id',
|
||||
'externo_updated_usuario_id',
|
||||
];
|
||||
|
||||
public function conectasusMaterial()
|
||||
{
|
||||
return $this->belongsTo(CadastroMaterial::class);
|
||||
}
|
||||
|
||||
public function entradaItens()
|
||||
{
|
||||
return $this->hasMany(EntradaItem::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\WebService\Almoxarifado\Cliente;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class PeriodoContabil extends Model
|
||||
{
|
||||
protected $table = 'web_service_almoxarifado_cliente_periodo_contabil';
|
||||
|
||||
protected $casts = [
|
||||
'inicio' => 'datetime:Y-m-d',
|
||||
'fim' => 'datetime:Y-m-d',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'inicio',
|
||||
'fim',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'externo_created_usuario_id',
|
||||
'externo_updated_usuario_id',
|
||||
];
|
||||
}
|
||||
43
api/app/Models/WebService/Almoxarifado/Cliente/Unidade.php
Normal file
43
api/app/Models/WebService/Almoxarifado/Cliente/Unidade.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\WebService\Almoxarifado\Cliente;
|
||||
|
||||
use App\Models\Cadastro\Estabelecimento\CentroCusto as CadastroCentroCusto;
|
||||
use App\Models\Model;
|
||||
|
||||
class Unidade extends Model
|
||||
{
|
||||
protected $table = 'web_service_almoxarifado_cliente_unidade';
|
||||
|
||||
protected $casts = [
|
||||
'is_almoxarifado' => 'boolean',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'conectasus_centro_custo_id',
|
||||
'nome',
|
||||
'cnes',
|
||||
'is_almoxarifado',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'externo_created_usuario_id',
|
||||
'externo_updated_usuario_id',
|
||||
];
|
||||
|
||||
public function conectasusCentroCusto()
|
||||
{
|
||||
return $this->belongsTo(CadastroCentroCusto::class);
|
||||
}
|
||||
|
||||
public function entradas()
|
||||
{
|
||||
return $this->hasMany(Entrada::class);
|
||||
}
|
||||
}
|
||||
39
api/app/Models/WebService/Laboratorio/Cliente/Exame.php
Normal file
39
api/app/Models/WebService/Laboratorio/Cliente/Exame.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\WebService\Laboratorio\Cliente;
|
||||
|
||||
use App\Models\Parametrizacao\Exame\Exame as CadastroExame;
|
||||
use App\Models\Model;
|
||||
|
||||
class Exame extends Model
|
||||
{
|
||||
protected $table = 'web_service_laboratorio_cliente_exame';
|
||||
|
||||
protected $fillable = [
|
||||
'laboratorio_id',
|
||||
'conectasus_exame_id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'laboratorio_id',
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
'externo_created_usuario_id',
|
||||
'externo_updated_usuario_id',
|
||||
];
|
||||
|
||||
public function laboratorio()
|
||||
{
|
||||
return $this->belongsTo(Laboratorio::class);
|
||||
}
|
||||
|
||||
public function conectasusExame()
|
||||
{
|
||||
return $this->belongsTo(CadastroExame::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\WebService\Laboratorio\Cliente;
|
||||
|
||||
use App\Models\Cadastro\Estabelecimento\Infraestrutura as CadastroInfraestrutura;
|
||||
use App\Models\Model;
|
||||
|
||||
class Laboratorio extends Model
|
||||
{
|
||||
protected $table = 'web_service_laboratorio_cliente_laboratorio';
|
||||
|
||||
protected $fillable = [
|
||||
'conectasus_infraestrutura_id',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function conectasusInfraestrutura()
|
||||
{
|
||||
return $this->belongsTo(CadastroInfraestrutura::class);
|
||||
}
|
||||
|
||||
public function exames()
|
||||
{
|
||||
return $this->hasMany(Exame::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\WebService\Laboratorio\Cliente;
|
||||
|
||||
use App\Models\ExameLaboratorial\AgendamentoExame\Agendamento AS ExameLaboratorialAgendamento;
|
||||
use App\Models\Model;
|
||||
|
||||
class PedidoMovimentacao extends Model
|
||||
{
|
||||
protected $table = 'web_service_laboratorio_cliente_pedido_movimentacao';
|
||||
|
||||
protected $casts = [
|
||||
'movimentado_em' => 'datetime:Y-m-d H:i:s',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'conectasus_exame_laboratorial_agendamento_id',
|
||||
'status_id',
|
||||
'motivo',
|
||||
'movimentado_em',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'externo_created_usuario_id',
|
||||
'externo_updated_usuario_id',
|
||||
];
|
||||
|
||||
public function pedido()
|
||||
{
|
||||
return $this->belongsTo(ExameLaboratorialAgendamento::class, 'conectasus_exame_laboratorial_agendamento_id');
|
||||
}
|
||||
|
||||
public function status()
|
||||
{
|
||||
return $this->belongsTo(PedidoStatus::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\WebService\Laboratorio\Cliente;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class PedidoStatus extends Model
|
||||
{
|
||||
protected $table = 'web_service_laboratorio_cliente_pedido_status';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
31
api/app/Models/WebService/LogAcesso.php
Normal file
31
api/app/Models/WebService/LogAcesso.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\WebService;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class LogAcesso extends Model
|
||||
{
|
||||
protected $table = 'web_service_log_acesso';
|
||||
|
||||
protected $casts = [
|
||||
'acessado_em' => 'datetime',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'usuario_id',
|
||||
'controlador',
|
||||
'metodo',
|
||||
'acessado_em',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function usuario()
|
||||
{
|
||||
return $this->belongsTo(Usuario::class);
|
||||
}
|
||||
}
|
||||
20
api/app/Models/WebService/Permissao.php
Normal file
20
api/app/Models/WebService/Permissao.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\WebService;
|
||||
|
||||
use App\Models\Model;
|
||||
|
||||
class Permissao extends Model
|
||||
{
|
||||
protected $table = 'web_service_permissao';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'nome',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
82
api/app/Models/WebService/Usuario.php
Normal file
82
api/app/Models/WebService/Usuario.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\WebService;
|
||||
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Tymon\JWTAuth\Contracts\JWTSubject;
|
||||
|
||||
class Usuario extends Authenticatable implements JWTSubject
|
||||
{
|
||||
protected $table = 'web_service_usuario';
|
||||
|
||||
protected $fillable = [
|
||||
'nome',
|
||||
'usuario',
|
||||
'senha',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'senha',
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
|
||||
public function setSenhaAttribute($value)
|
||||
{
|
||||
$this->attributes['senha'] = Hash::make($value);
|
||||
}
|
||||
|
||||
public function permissoes()
|
||||
{
|
||||
return $this->belongsToMany(Permissao::class, 'web_service_usuario_permissao', 'usuario_id', 'permissao_id')
|
||||
->using(UsuarioPermissao::class)
|
||||
->as('pivotUsuarioPermissao')
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function logsAcessos()
|
||||
{
|
||||
return $this->hasMany(LogAcesso::class);
|
||||
}
|
||||
|
||||
public function getJWTIdentifier()
|
||||
{
|
||||
return $this->getKey();
|
||||
}
|
||||
|
||||
public function getJWTCustomClaims()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::creating(function ($model) {
|
||||
|
||||
if (auth()->check()) {
|
||||
|
||||
$model->created_lotacao_id = auth()->payload()->get('lotacao_id');
|
||||
$model->created_centro_custo_id = auth()->payload()->get('centro_custo_id');
|
||||
|
||||
$model->updated_lotacao_id = auth()->payload()->get('lotacao_id');
|
||||
$model->updated_centro_custo_id = auth()->payload()->get('centro_custo_id');
|
||||
}
|
||||
});
|
||||
|
||||
static::updating(function ($model) {
|
||||
|
||||
if (auth()->check()) {
|
||||
|
||||
$model->updated_lotacao_id = auth()->payload()->get('lotacao_id');
|
||||
$model->updated_centro_custo_id = auth()->payload()->get('centro_custo_id');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
17
api/app/Models/WebService/UsuarioPermissao.php
Normal file
17
api/app/Models/WebService/UsuarioPermissao.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\WebService;
|
||||
|
||||
use App\Models\Pivot;
|
||||
|
||||
class UsuarioPermissao extends Pivot
|
||||
{
|
||||
protected $hidden = [
|
||||
'created_at',
|
||||
'created_lotacao_id',
|
||||
'created_centro_custo_id',
|
||||
'updated_at',
|
||||
'updated_lotacao_id',
|
||||
'updated_centro_custo_id',
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user