Update Routes Untuk Show(Country, Ethnic, Race dan Religion)
This commit is contained in:
parent
9124b49813
commit
52f11e6f1a
@ -21,6 +21,13 @@ $routes->delete('/api/patient/(:num)', 'Patient::delete/$1');
|
||||
$routes->patch('/api/patient/(:num)', 'Patient::update/$1');
|
||||
|
||||
$routes->get('/api/race', 'Race::index');
|
||||
$routes->get('/api/race/(:num)', 'Race::show/$1');
|
||||
|
||||
$routes->get('/api/country', 'Country::index');
|
||||
$routes->get('/api/country/(:num)', 'Country::show/$1');
|
||||
|
||||
$routes->get('/api/religion', 'Religion::index');
|
||||
$routes->get('/api/ethnic', 'Ethnic::index');
|
||||
$routes->get('/api/religion/(:num)', 'Religion::show/$1');
|
||||
|
||||
$routes->get('/api/ethnic', 'Ethnic::index');
|
||||
$routes->get('/api/ethnic/(:num)', 'Ethnic::show/$1');
|
||||
@ -31,7 +31,24 @@ class Country extends Controller {
|
||||
'data' => $data,
|
||||
], 200);
|
||||
} catch (\Exception $e) {
|
||||
return $this->failServerError('Something went wrong');
|
||||
return $this->failServerError('Something went wrong '.$e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function show($IntCountryID = null) {
|
||||
try {
|
||||
|
||||
$sql = "SELECT IntCountryID, CountryID, Country FROM country WHERE IntCountryID = $IntCountryID";
|
||||
$data = $this->db->query($sql)->getResultArray();
|
||||
|
||||
return $this->respond([
|
||||
'status' => 'success',
|
||||
'message'=> "Country with IntCountryID $IntCountryID fetched successfully",
|
||||
'data' => $data,
|
||||
], 200);
|
||||
} catch (\Exception $e) {
|
||||
return $this->failServerError('Something went wrong '.$e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -13,16 +13,31 @@ class Ethnic extends Controller {
|
||||
|
||||
public function index() {
|
||||
try {
|
||||
$sql = "select * from ethnic";
|
||||
$sql = "SELECT * FROM ethnic";
|
||||
$data = $this->db->query($sql)->getResultArray();
|
||||
|
||||
return $this->respond([
|
||||
'status' => 'success',
|
||||
'message'=> "Ethnic fetched successfully",
|
||||
'data' => $data,
|
||||
], 200);
|
||||
return $this->respond([
|
||||
'status' => 'success',
|
||||
'message'=> "Ethnic fetched successfully",
|
||||
'data' => $data,
|
||||
], 200);
|
||||
} catch (\Exception $e) {
|
||||
return $this->failServerError('Something went wrong');
|
||||
return $this->failServerError('Something went wrong '. $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function show($EthnicID = null) {
|
||||
try {
|
||||
$sql = "SELECT * FROM ethnic WHERE EthnicID=$EthnicID";
|
||||
$data = $this->db->query($sql)->getResultArray();
|
||||
|
||||
return $this->respond([
|
||||
'status' => 'success',
|
||||
'message'=> "Ethnic with EthnicID $EthnicID fetched successfully",
|
||||
'data' => $data,
|
||||
], 200);
|
||||
} catch (\Exception $e) {
|
||||
return $this->failServerError('Something went wrong '. $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -13,16 +13,31 @@ class Race extends Controller {
|
||||
|
||||
public function index() {
|
||||
try {
|
||||
$sql = "select * from race";
|
||||
$sql = "SELECT * FROM race";
|
||||
$data = $this->db->query($sql)->getResultArray();
|
||||
|
||||
return $this->respond([
|
||||
'status' => 'success',
|
||||
'message'=> "Race fetched successfully",
|
||||
'data' => $data,
|
||||
], 200);
|
||||
return $this->respond([
|
||||
'status' => 'success',
|
||||
'message'=> "Race fetched successfully",
|
||||
'data' => $data,
|
||||
], 200);
|
||||
} catch (\Exception $e) {
|
||||
return $this->failServerError('Something went wrong');
|
||||
return $this->failServerError('Something went wrong'. $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function show($RaceID = null) {
|
||||
try {
|
||||
$sql = "SELECT * FROM race WHERE RacrID = $RaceID";
|
||||
$data = $this->db->query($sql)->getResultArray();
|
||||
|
||||
return $this->respond([
|
||||
'status' => 'success',
|
||||
'message'=> "Race with RaceID $RaceID fetched successfully",
|
||||
'data' => $data,
|
||||
], 200);
|
||||
} catch (\Exception $e) {
|
||||
return $this->failServerError('Something went wrong'. $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -12,17 +12,32 @@ class Religion extends Controller {
|
||||
}
|
||||
|
||||
public function index() {
|
||||
try {
|
||||
$sql = "select * from religion";
|
||||
$data = $this->db->query($sql)->getResultArray();
|
||||
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');
|
||||
return $this->respond([
|
||||
'status' => 'success',
|
||||
'message'=> "Religion fetched successfully",
|
||||
'data' => $data,
|
||||
], 200);
|
||||
} catch (\Exception $e) {
|
||||
return $this->failServerError('Something went wrong '. $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function show($ReligionID = null) {
|
||||
try {
|
||||
$sql = "SELECT * FROM religion WHERE ReligionID = $ReligionID";
|
||||
$data = $this->db->query($sql)->getResultArray();
|
||||
|
||||
return $this->respond([
|
||||
'status' => 'success',
|
||||
'message'=> "Religion with ReligionID $ReligionID fetched successfully",
|
||||
'data' => $data,
|
||||
], 200);
|
||||
} catch (\Exception $e) {
|
||||
return $this->failServerError('Something went wrong '.$e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user