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 '. $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()); } } }