clqms-be/app/Models/RefRange/RefTxtModel.php

44 lines
863 B
PHP

<?php
namespace App\Models\RefRange;
use App\Models\BaseModel;
class RefTxtModel extends BaseModel
{
protected $table = 'reftxt';
protected $primaryKey = 'RefTxtID';
protected $allowedFields = [
'SiteID',
'TestSiteID',
'SpcType',
'Sex',
'Criteria',
'AgeStart',
'AgeEnd',
'TxtRefType',
'RefTxt',
'Flag',
'Notes',
'CreateDate',
'StartDate',
'EndDate'
];
protected $useTimestamps = true;
protected $createdField = 'CreateDate';
protected $updatedField = '';
protected $useSoftDeletes = true;
protected $deletedField = "EndDate";
/**
* Get active text reference ranges for a test
*/
public function getActiveByTestSiteID($testSiteID) {
return $this->where('TestSiteID', $testSiteID)
->where('EndDate', null)
->orderBy('RefTxtID', 'ASC')
->findAll();
}
}