changes to management
This commit is contained in:
49
app/Models/Position.php
Normal file
49
app/Models/Position.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Traits\AuditLogTrait;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Position extends BaseModel
|
||||
{
|
||||
public $timestamps = false;
|
||||
|
||||
use HasFactory;
|
||||
use AuditLogTrait;
|
||||
|
||||
protected $table = 'positions';
|
||||
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
protected $fillable = [
|
||||
'box_id',
|
||||
'code',
|
||||
'row_label',
|
||||
'column_label',
|
||||
'occupied',
|
||||
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 box()
|
||||
{
|
||||
return $this->belongsTo(Box::class, 'box_id', 'id');
|
||||
}
|
||||
|
||||
public function aliquot()
|
||||
{
|
||||
return $this->hasOne(Aliquot::class, 'storage_position_id', 'id')
|
||||
->where(BaseModel::RECORD_STATUS_FIELD, BaseModel::RECORD_STATUS_ACTIVE);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user