From 11dca70c705e216107d75a9d4e07e7bc02752ec7 Mon Sep 17 00:00:00 2001 From: mahdahar <89adham@gmail.com> Date: Wed, 15 Oct 2025 13:09:00 +0700 Subject: [PATCH] update condef color --- app/Controllers/Specimen/ContainerDef.php | 2 +- app/Database/Migrations/2025-10-07-132705_Specimen.php | 4 ++-- app/Models/Specimen/ContainerDefModel.php | 6 ++++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/Controllers/Specimen/ContainerDef.php b/app/Controllers/Specimen/ContainerDef.php index 81ade9e..d1f10c3 100644 --- a/app/Controllers/Specimen/ContainerDef.php +++ b/app/Controllers/Specimen/ContainerDef.php @@ -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()); diff --git a/app/Database/Migrations/2025-10-07-132705_Specimen.php b/app/Database/Migrations/2025-10-07-132705_Specimen.php index ee7125f..12fc1eb 100644 --- a/app/Database/Migrations/2025-10-07-132705_Specimen.php +++ b/app/Database/Migrations/2025-10-07-132705_Specimen.php @@ -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] ]); diff --git a/app/Models/Specimen/ContainerDefModel.php b/app/Models/Specimen/ContainerDefModel.php index 73a62b4..336afe4 100644 --- a/app/Models/Specimen/ContainerDefModel.php +++ b/app/Models/Specimen/ContainerDefModel.php @@ -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; + } } \ No newline at end of file