mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-28 10:53:40 +03:00
Type casting for the Secretaries_model.php
This commit is contained in:
parent
23cdaa2c6b
commit
879b58ad6a
1 changed files with 31 additions and 1 deletions
|
@ -19,6 +19,14 @@
|
||||||
* @package Models
|
* @package Models
|
||||||
*/
|
*/
|
||||||
class Secretaries_model extends EA_Model {
|
class Secretaries_model extends EA_Model {
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts = [
|
||||||
|
'id' => 'integer',
|
||||||
|
'id_roles' => 'integer',
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save (insert or update) a secretary.
|
* Save (insert or update) a secretary.
|
||||||
*
|
*
|
||||||
|
@ -516,7 +524,7 @@ class Secretaries_model extends EA_Model {
|
||||||
{
|
{
|
||||||
$role_id = $this->get_secretary_role_id();
|
$role_id = $this->get_secretary_role_id();
|
||||||
|
|
||||||
return $this
|
$secretaries = $this
|
||||||
->db
|
->db
|
||||||
->select()
|
->select()
|
||||||
->from('users')
|
->from('users')
|
||||||
|
@ -536,6 +544,28 @@ class Secretaries_model extends EA_Model {
|
||||||
->order_by($order_by)
|
->order_by($order_by)
|
||||||
->get()
|
->get()
|
||||||
->result_array();
|
->result_array();
|
||||||
|
|
||||||
|
foreach ($secretaries as &$secretary)
|
||||||
|
{
|
||||||
|
$secretary['settings'] = $this->db->get_where('user_settings', ['id_users' => $secretary['id']])->row_array();
|
||||||
|
|
||||||
|
unset(
|
||||||
|
$secretary['settings']['id_users'],
|
||||||
|
$secretary['settings']['password'],
|
||||||
|
$secretary['settings']['salt']
|
||||||
|
);
|
||||||
|
|
||||||
|
$secretary_provider_connections = $this->db->get_where('secretaries_providers', ['id_users_secretary' => $secretary['id']])->result_array();
|
||||||
|
|
||||||
|
$secretary['providers'] = [];
|
||||||
|
|
||||||
|
foreach ($secretary_provider_connections as $secretary_provider_connection)
|
||||||
|
{
|
||||||
|
$secretary['providers'][] = (int)$secretary_provider_connection['id_users_provider'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $secretaries;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue