diff --git a/application/core/EA_Model.php b/application/core/EA_Model.php index 6ecb6dd6..f8cc3c30 100644 --- a/application/core/EA_Model.php +++ b/application/core/EA_Model.php @@ -178,4 +178,16 @@ class EA_Model extends CI_Model { return in_array($field, $fields); }, ARRAY_FILTER_USE_KEY); } + + /** + * Get the DB field name based on an API field name. + * + * @param string $api_field API resource key. + * + * @return string|null Returns the column field or null if non found. + */ + public function db_field(string $api_field): ?string + { + return $this->api_resource[$api_field] ?? NULL; + } }