53 lines
1017 B
PHP
53 lines
1017 B
PHP
<?php
|
|
|
|
namespace App\Models\Almoxarifado;
|
|
|
|
use App\Models\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class MotivoBaixa extends Model
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $table = 'almoxarifado_motivo_baixa';
|
|
|
|
protected $casts = [
|
|
'justificar' => 'boolean',
|
|
];
|
|
|
|
protected $fillable = [
|
|
'tipo_id',
|
|
'descricao',
|
|
'justificar',
|
|
];
|
|
|
|
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 tipo()
|
|
{
|
|
return $this->belongsTo(MotivoBaixaTipo::class);
|
|
}
|
|
|
|
public function baixas()
|
|
{
|
|
return $this->hasMany(SaidaBaixa::class, 'motivo_id');
|
|
}
|
|
|
|
public function getIsAllowedToDeleteAttribute()
|
|
{
|
|
return $this->hasNoOne([
|
|
'baixas',
|
|
]);
|
|
}
|
|
}
|