update condef color

This commit is contained in:
mahdahar 2025-10-15 13:09:00 +07:00
parent 20350db5bd
commit 11dca70c70
3 changed files with 9 additions and 3 deletions

View File

@ -33,7 +33,7 @@ class ContainerDef extends BaseController {
public function show($ConDefID) {
try {
$rows = $this->model->find($ConDefID);
$rows = $this->model->getContainer($ConDefID);
return $this->respond([ 'status' => 'success', 'message'=> "data fetched successfully", 'data' => $rows ], 200);
} catch (\Exception $e) {
return $this->failServerError('Exception : '.$e->getMessage());

View File

@ -14,8 +14,8 @@ class CreateSpecimenTable extends Migration {
'ConName' => ['type' => 'varchar', 'constraint' => 50, 'null' => true],
'ConDesc' => ['type' => 'varchar', 'constraint' => 50, 'null' => true],
'Additive' => ['type' => 'varchar', 'constraint' => 50, 'null' => true],
'ConClass' => ['type' => 'int', 'null' => false],
'Color' => ['type' => 'int', 'null' => false],
'ConClass' => ['type' => 'int', 'null' => true],
'Color' => ['type' => 'int', 'null' => true],
'CreateDate' => ['type' => 'Datetime', 'null' => true],
'EndDate' => ['type' => 'DATETIME', 'null' => true]
]);

View File

@ -20,4 +20,10 @@ class ContainerDefModel extends BaseModel {
protected $afterInsert = ['convertDatesToUTCISO'];
protected $afterUpdate = ['convertDatesToUTCISO'];
public function getContainer($ConDefID) {
$rows = $this->select('containerdef.*, ValueSet.VValue as ColorTxt')
->join('ValueSet', 'ValueSet.VID=containerdef.Color', 'left')
->where('ConDefID', $ConDefID)->get()->getResultArray();
return $rows;
}
}