Files
hpt_inventory/app/Models/Equipment.php
2026-07-07 09:29:00 +07:00

51 lines
1.2 KiB
PHP

<?php
namespace App\Models;
use App\Enums\RecordStatusEnum;
use App\Models\Traits\HasLocalizedName;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Support\Facades\Session;
use App\Traits\AuditLogTrait;
class Equipment extends BaseModel
{
public $timestamps = false;
use HasFactory;
use HasLocalizedName;
use AuditLogTrait;
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'equipments';
protected $appends = ['name'];
protected $primaryKey = 'id';
protected $fillable = [
'code', 'room_id', 'name_en','capacity', 'model', 'serial_number', 'organization_id',
'equipment_type_concept_id', 'min_temperature', 'max_temperature', 'status', 'installed_date',
BaseModel::CREATED_BY_FIELD, BaseModel::UPDATED_AT_FIELD, BaseModel::UPDATED_BY_FIELD,
BaseModel::DELETED_AT_FIELD, BaseModel::DELETED_BY_FIELD, BaseModel::RECORD_STATUS_FIELD
];
public static function boot()
{
parent::boot();
}
public function type(){
return $this->belongsTo(Concept::class, 'equipment_type_concept_id', 'id');
}
public function room(){
return $this->belongsTo(Room::class, 'room_id', 'id');
}
}