This commit is contained in:
62
api/app/Models/Cadastro/Subgrupo/Subgrupo.php
Normal file
62
api/app/Models/Cadastro/Subgrupo/Subgrupo.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Cadastro\Subgrupo;
|
||||
|
||||
use App\Models\Almoxarifado\ParametrizacaoControleEstoqueSubgrupo;
|
||||
use App\Models\Cadastro\Grupo\Grupo;
|
||||
use App\Models\Cadastro\Material\Material;
|
||||
use App\Models\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use App\Models\Almoxarifado\ParametrizacaoPortalDivulgacaoSubgrupo;
|
||||
|
||||
class Subgrupo extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'cadastro_subgrupo';
|
||||
|
||||
protected $fillable = [
|
||||
'grupo_id',
|
||||
'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 grupo()
|
||||
{
|
||||
return $this->belongsTo(Grupo::class);
|
||||
}
|
||||
|
||||
public function materiais()
|
||||
{
|
||||
return $this->hasMany(Material::class);
|
||||
}
|
||||
|
||||
public function almoxarifadoParametrizacoesControleEstoqueSubgrupo()
|
||||
{
|
||||
return $this->hasMany(ParametrizacaoControleEstoqueSubgrupo::class);
|
||||
}
|
||||
|
||||
public function almoxarifadoParametrizacoesPortalDivulgacaoSubgrupo()
|
||||
{
|
||||
return $this->hasMany(ParametrizacaoPortalDivulgacaoSubgrupo::class);
|
||||
}
|
||||
|
||||
public function getIsAllowedToDeleteAttribute()
|
||||
{
|
||||
return $this->hasNoOne([
|
||||
'materiais',
|
||||
'almoxarifadoParametrizacoesControleEstoqueSubgrupo',
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user