changes to management
This commit is contained in:
72
app/Models/Aliquot.php
Normal file
72
app/Models/Aliquot.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Traits\AuditLogTrait;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Aliquot extends BaseModel
|
||||
{
|
||||
public $timestamps = false;
|
||||
|
||||
use HasFactory;
|
||||
use AuditLogTrait;
|
||||
|
||||
protected $table = 'aliquots';
|
||||
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
protected $fillable = [
|
||||
'sample_id',
|
||||
'container_type_id',
|
||||
'aliquot_type_concept_id',
|
||||
'parent_aliquot_id',
|
||||
'aliquot_number',
|
||||
'initial_volume',
|
||||
'remaining_volume',
|
||||
'volume_unit',
|
||||
'concentration',
|
||||
'storage_position_id',
|
||||
'expiry_date',
|
||||
'status',
|
||||
'last_accessed_at',
|
||||
'description',
|
||||
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 position()
|
||||
{
|
||||
return $this->belongsTo(Position::class, 'storage_position_id', 'id');
|
||||
}
|
||||
|
||||
public function sample()
|
||||
{
|
||||
return $this->belongsTo(PathogenInventorySample::class, 'sample_id', 'id');
|
||||
}
|
||||
|
||||
public function containerType()
|
||||
{
|
||||
return $this->belongsTo(ContainerType::class, 'container_type_id', 'id');
|
||||
}
|
||||
|
||||
public function movements()
|
||||
{
|
||||
return $this->hasMany(AliqoutMovement::class, 'aliquot_id', 'id');
|
||||
}
|
||||
|
||||
public function transactions()
|
||||
{
|
||||
return $this->hasMany(AliquotTransaction::class, 'aliquot_id', 'id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user