Files
hpt_inventory/app/Models/Box.php
2026-08-17 10:18:11 +07:00

57 lines
1.1 KiB
PHP

<?php
namespace App\Models;
use App\Traits\AuditLogTrait;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class Box extends BaseModel
{
public $timestamps = false;
use HasFactory;
use AuditLogTrait;
/**
* The table associated with the model.
*
* Note: the current database schema uses the legacy table name "boxs".
*
* @var string
*/
protected $table = 'boxs';
protected $primaryKey = 'id';
protected $fillable = [
'rack_id',
'code',
'name',
'rows',
'columns',
'capacity',
BaseModel::CREATED_AT_FIELD,
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 rack()
{
return $this->belongsTo(Rack::class, 'rack_id', 'id');
}
public function positions()
{
return $this->hasMany(Position::class, 'box_id', 'id');
}
}