This commit is contained in:
63
api/app/Models/Bpa/Exportacao.php
Normal file
63
api/app/Models/Bpa/Exportacao.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Bpa;
|
||||
|
||||
use App\Models\Cadastro\Estabelecimento\Unidade;
|
||||
use App\Models\Model;
|
||||
use App\Models\Sigtap\Financiamento;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Exportacao extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'bpa_exportacao';
|
||||
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'status_id',
|
||||
'competencia_id',
|
||||
'arquivo',
|
||||
'data_hora_inicio',
|
||||
'data_hora_fim',
|
||||
'quantidade_consistencia',
|
||||
'quantidade_inconsistencia',
|
||||
'encaminhado',
|
||||
];
|
||||
|
||||
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 status()
|
||||
{
|
||||
return $this->belongsTo(ExportacaoStatus::class, 'status_id');
|
||||
}
|
||||
|
||||
public function unidades()
|
||||
{
|
||||
return $this->belongsToMany(Unidade::class, 'bpa_exportacao_unidade')
|
||||
->using(ExportacaoUnidade::class)
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function financiamentos()
|
||||
{
|
||||
return $this->belongsToMany(Financiamento::class, $this->getConnection()->getDatabaseName() . '.bpa_exportacao_financiamento')
|
||||
->using(ExportacaoFinanciamento::class)
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user