clqms-be/app/Models/Specimen/ContainerDefModel.php

31 lines
1.2 KiB
PHP
Raw Normal View History

2025-10-14 10:48:20 +07:00
<?php
namespace App\Models\Specimen;
use App\Models\BaseModel;
2025-10-14 10:48:20 +07:00
2025-10-14 18:53:06 +07:00
class ContainerDefModel extends BaseModel {
2025-10-14 10:48:20 +07:00
protected $table = 'containerdef';
protected $primaryKey = 'ConDefID';
protected $allowedFields = ['SiteID', 'ConCode', 'ConName', 'ConDesc', 'Additive', 'ConClass', 'Color', 'CreateDate', 'EndDate'];
protected $useTimestamps = true;
protected $createdField = 'CreateDate';
protected $updatedField = '';
protected $useSoftDeletes = true;
protected $deletedField = 'EndDate';
protected $beforeInsert = ['normalizeDatesToUTC'];
protected $beforeUpdate = ['normalizeDatesToUTC'];
protected $afterFind = ['convertDatesToUTCISO'];
protected $afterInsert = ['convertDatesToUTCISO'];
protected $afterUpdate = ['convertDatesToUTCISO'];
2025-10-15 13:09:00 +07:00
public function getContainer($ConDefID) {
2025-10-15 16:08:52 +07:00
$rows = $this->select('containerdef.*, vscol.VValue as ColorTxt, vscla.VValue as ConClassTxt, vsadd.VValue as AdditiveTxt')
->join('valueset vscol', 'vscol.VID=containerdef.Color', 'left')
->join('valueset vscla', 'vscla.VID=containerdef.ConClass', 'left')
->join('valueset vsadd', 'vsadd.VID=containerdef.Additive', 'left')
2025-10-15 13:09:00 +07:00
->where('ConDefID', $ConDefID)->get()->getResultArray();
return $rows;
}
2025-10-14 10:48:20 +07:00
}