67 lines
1.4 KiB
PHP
67 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Cadastro\Medicamento;
|
|
|
|
use App\Models\Cadastro\UnidadeMedida;
|
|
use App\Models\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class Medicamento extends Model
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $table = 'cadastro_medicamento';
|
|
|
|
protected $casts = [
|
|
'exibir_receita' => 'boolean',
|
|
'exibir_prescricao_interna' => 'boolean',
|
|
];
|
|
|
|
protected $fillable = [
|
|
'nome',
|
|
'unidade_medida_id',
|
|
'forma_farmaceutica_id',
|
|
'via_administracao_id',
|
|
'receita_tipo_id',
|
|
'exibir_receita',
|
|
'exibir_prescricao_interna',
|
|
];
|
|
|
|
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 receitaTipo()
|
|
{
|
|
return $this->belongsTo(ReceitaTipo::class);
|
|
}
|
|
|
|
public function unidadeMedida()
|
|
{
|
|
return $this->belongsTo(UnidadeMedida::class);
|
|
}
|
|
|
|
public function formaFarmaceutica()
|
|
{
|
|
return $this->belongsTo(FormaFarmaceutica::class);
|
|
}
|
|
|
|
public function viaAdministracao()
|
|
{
|
|
return $this->belongsTo(ViaAdministracao::class);
|
|
}
|
|
|
|
public function getIsAllowedToDeleteAttribute()
|
|
{
|
|
return true;
|
|
}
|
|
}
|