31 lines
1.2 KiB
PHP
31 lines
1.2 KiB
PHP
<?php
|
|
namespace App\Models\Specimen;
|
|
|
|
use App\Models\BaseModel;
|
|
|
|
class ContainerDefModel extends BaseModel {
|
|
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'];
|
|
|
|
public function getContainer($ConDefID) {
|
|
$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')
|
|
->where('ConDefID', $ConDefID)->get()->getResultArray();
|
|
return $rows;
|
|
}
|
|
} |