fix race religion ethnic country

This commit is contained in:
mahdahar 2025-08-01 11:37:03 +07:00
parent 24715c5b97
commit cbf4f7a486
7 changed files with 86 additions and 29 deletions

View File

@ -14,11 +14,12 @@ $routes->post('/auth/login/', 'Auth::login');
$routes->post('/auth/change_pass/', 'Auth::change_pass');
$routes->post('/auth/register/', 'Auth::register');
$routes->get('/patient', 'Patient::index');
$routes->post('/patient', 'Patient::create');
$routes->delete('/patient/(:any)', 'Patient::delete/$1');
$routes->patch('/patient/(:num)', 'Patient::update/$1');
$routes->get('/api/patient', 'Patient::index');
$routes->post('/api/patient', 'Patient::create');
$routes->delete('/api/patient/(:any)', 'Patient::delete/$1');
$routes->patch('/api/patient/(:num)', 'Patient::update/$1');
$routes->get('/patient/race', 'PatientRace::index');
$routes->get('/patient/country', 'PatientCountry::index');
$routes->get('/patient/religion', 'PatientReligion::index');
$routes->get('/api/race', 'Race::index');
$routes->get('/api/country', 'Country::index');
$routes->get('/api/religion', 'Religion::index');
$routes->get('/api/ethnic', 'Ethnic::index');

View File

@ -3,16 +3,26 @@ namespace App\Controllers;
use CodeIgniter\API\ResponseTrait;
use CodeIgniter\Controller;
use CodeIgniter\Database\RawSql;
class Country extends Controller {
use ResponseTrait;
public function index() {
public function __construct() {
$this->db = \Config\Database::connect();
}
return $this->respond([
'status' => 'success',
'data' => $data,
]);
public function index() {
try {
$sql = "select * from country";
$data = $this->db->query($sql)->getResultArray();
return $this->respond([
'status' => 'success',
'message'=> "Country fetched successfully",
'data' => $data,
], 200);
} catch (\Exception $e) {
return $this->failServerError('Something went wrong');
}
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Controllers;
use CodeIgniter\API\ResponseTrait;
use CodeIgniter\Controller;
class Ethnic extends Controller {
use ResponseTrait;
public function __construct() {
$this->db = \Config\Database::connect();
}
public function index() {
try {
$sql = "select * from ethnic";
$data = $this->db->query($sql)->getResultArray();
return $this->respond([
'status' => 'success',
'message'=> "Ethnic fetched successfully",
'data' => $data,
], 200);
} catch (\Exception $e) {
return $this->failServerError('Something went wrong');
}
}
}

View File

@ -14,7 +14,6 @@ class Patient extends Controller {
// OK
public function index() {
try {
$pat_num = $this->request->getVar('pat_num');
$pat_altnum = $this->request->getVar('pat_altnum');

View File

@ -3,17 +3,26 @@ namespace App\Controllers;
use CodeIgniter\API\ResponseTrait;
use CodeIgniter\Controller;
use CodeIgniter\Database\RawSql;
class PatientRace extends Controller {
use ResponseTrait;
class Race extends Controller {
use ResponseTrait;
public function index() {
return $this->respond([
'status' => 'success',
'data' => $data,
]);
public function __construct() {
$this->db = \Config\Database::connect();
}
public function index() {
try {
$sql = "select * from race";
$data = $this->db->query($sql)->getResultArray();
return $this->respond([
'status' => 'success',
'message'=> "Race fetched successfully",
'data' => $data,
], 200);
} catch (\Exception $e) {
return $this->failServerError('Something went wrong');
}
}
}

View File

@ -3,17 +3,26 @@ namespace App\Controllers;
use CodeIgniter\API\ResponseTrait;
use CodeIgniter\Controller;
use CodeIgniter\Database\RawSql;
class PatientReligion extends Controller {
class Religion extends Controller {
use ResponseTrait;
public function __construct() {
$this->db = \Config\Database::connect();
}
public function index() {
try {
$sql = "select * from religion";
$data = $this->db->query($sql)->getResultArray();
return $this->respond([
'status' => 'success',
'message'=> "Religion fetched successfully",
'data' => $data,
]);
], 200);
} catch (\Exception $e) {
return $this->failServerError('Something went wrong');
}
}
}

View File

@ -15,6 +15,7 @@ Options -Indexes
# change the following line to match the subfolder you need.
# http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritebase
# RewriteBase /
RewriteBase /clqms01/
# Redirect Trailing Slashes...
RewriteCond %{REQUEST_FILENAME} !-d