38 lines
1.0 KiB
PHP
38 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models\ValueSet;
|
|
|
|
use App\Models\BaseModel;
|
|
|
|
class ValueSetDefModel extends BaseModel {
|
|
protected $table = 'valuesetdef';
|
|
protected $primaryKey = 'VSetID';
|
|
protected $allowedFields = ['SiteID', 'VSName', 'VSDesc', '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 getValueSetDefs($param = null) {
|
|
if ($param !== null) {
|
|
$builder = $this->builder();
|
|
$builder->like('VSName', $param, 'both');
|
|
$builder->orlike('VSDesc', $param, 'both');
|
|
$rows = $builder->get()->getResultArray();
|
|
} else {
|
|
$rows = $this->findAll();
|
|
}
|
|
return $rows;
|
|
}
|
|
|
|
|
|
}
|