From 6eaa6e52a579b3811676d8d943f09a564c764ef2 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Wed, 3 Nov 2021 08:21:03 +0100 Subject: [PATCH] Added API resource mapping --- application/models/Admins_model.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/application/models/Admins_model.php b/application/models/Admins_model.php index a27af2dd..3899d66b 100644 --- a/application/models/Admins_model.php +++ b/application/models/Admins_model.php @@ -27,6 +27,26 @@ class Admins_model extends EA_Model { 'id_roles' => 'integer', ]; + /** + * @var array + */ + protected $api_resource = [ + 'id' => 'id', + 'firstName' => 'first_name', + 'lastName' => 'last_name', + 'email' => 'email', + 'mobile' => 'mobile_number', + 'phone' => 'phone_number', + 'address' => 'address', + 'city' => 'city', + 'state' => 'state', + 'zip' => 'zip_code', + 'notes' => 'notes', + 'timezone' => 'timezone', + 'language' => 'language', + 'roleId' => 'id_roles', + ]; + /** * Save (insert or update) an admin. * @@ -560,7 +580,7 @@ class Admins_model extends EA_Model { * @param array &$admin API resource. * @param array|null $base Base admin data to be overwritten with the provided values (useful for updates). */ - public function decode(array &$admin, array $base = NULL) + public function api_decode(array &$admin, array $base = NULL) { $decoded_response = $base ?? [];