mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-12-22 14:42:23 +03:00
Minor changes to the model classes
This commit is contained in:
parent
75a5addbc2
commit
a48324be08
6 changed files with 28 additions and 14 deletions
|
@ -156,7 +156,7 @@ class Admins_model extends EA_Model {
|
|||
{
|
||||
$num_rows = $this->db->get_where('user_settings',
|
||||
['username' => $username, 'id_users <> ' => $user_id])->num_rows();
|
||||
return ($num_rows > 0) ? FALSE : TRUE;
|
||||
return $num_rows > 0 ? FALSE : TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -232,7 +232,7 @@ class Appointments_model extends EA_Model {
|
|||
])
|
||||
->num_rows();
|
||||
|
||||
return ($num_rows > 0) ? TRUE : FALSE;
|
||||
return $num_rows > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -381,6 +381,7 @@ class Appointments_model extends EA_Model {
|
|||
* @param bool $aggregates (OPTIONAL) Defines whether to add aggregations or not.
|
||||
*
|
||||
* @return array Returns the rows from the database.
|
||||
* @throws Exception
|
||||
*/
|
||||
public function get_batch($where = NULL, $order_by = NULL, $limit = NULL, $offset = NULL, $aggregates = FALSE)
|
||||
{
|
||||
|
|
|
@ -158,7 +158,7 @@ class Customers_model extends EA_Model {
|
|||
->where('roles.slug', DB_SLUG_CUSTOMER)
|
||||
->get()->num_rows();
|
||||
|
||||
return ($num_rows > 0) ? TRUE : FALSE;
|
||||
return $num_rows > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -187,7 +187,7 @@ class Providers_model extends EA_Model {
|
|||
{
|
||||
$num_rows = $this->db->get_where('user_settings',
|
||||
['username' => $username, 'id_users <> ' => $user_id])->num_rows();
|
||||
return ($num_rows > 0) ? FALSE : TRUE;
|
||||
return $num_rows > 0 ? FALSE : TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -215,7 +215,7 @@ class Providers_model extends EA_Model {
|
|||
->where('roles.slug', DB_SLUG_PROVIDER)
|
||||
->get()->num_rows();
|
||||
|
||||
return ($num_rows > 0) ? TRUE : FALSE;
|
||||
return $num_rows > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -348,6 +348,8 @@ class Providers_model extends EA_Model {
|
|||
* @param string $setting_name The setting's name.
|
||||
* @param string $value The setting's value.
|
||||
* @param int $provider_id The selected provider id.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function set_setting($setting_name, $value, $provider_id)
|
||||
{
|
||||
|
@ -429,7 +431,7 @@ class Providers_model extends EA_Model {
|
|||
/**
|
||||
* Delete an existing provider record from the database.
|
||||
*
|
||||
* @param int $customer_id The record id to be deleted.
|
||||
* @param $provider_id
|
||||
*
|
||||
* @return bool Returns the delete operation result.
|
||||
*
|
||||
|
|
|
@ -165,7 +165,7 @@ class Secretaries_model extends EA_Model {
|
|||
{
|
||||
$num_rows = $this->db->get_where('user_settings',
|
||||
['username' => $username, 'id_users <> ' => $user_id])->num_rows();
|
||||
return ($num_rows > 0) ? FALSE : TRUE;
|
||||
return $num_rows > 0 ? FALSE : TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -193,7 +193,7 @@ class Secretaries_model extends EA_Model {
|
|||
->where('roles.slug', DB_SLUG_SECRETARY)
|
||||
->get()->num_rows();
|
||||
|
||||
return ($num_rows > 0) ? TRUE : FALSE;
|
||||
return $num_rows > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -344,6 +344,8 @@ class Secretaries_model extends EA_Model {
|
|||
* @param string $setting_name The setting's name.
|
||||
* @param string $value The setting's value.
|
||||
* @param int $secretary_id The selected provider id.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function set_setting($setting_name, $value, $secretary_id)
|
||||
{
|
||||
|
|
|
@ -186,17 +186,19 @@ class Services_model extends EA_Model {
|
|||
'price' => $service['price']
|
||||
])->num_rows();
|
||||
|
||||
return ($num_rows > 0) ? TRUE : FALSE;
|
||||
return $num_rows > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the record id of an existing record.
|
||||
*
|
||||
* NOTICE: The record must exist, otherwise an exception will be raised.
|
||||
* Notice: The record must exist, otherwise an exception will be raised.
|
||||
*
|
||||
* @param array $service Contains the service record data. Name, duration and price values are mandatory for this
|
||||
* method to complete.
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @throws Exception If required fields are missing.
|
||||
* @throws Exception If requested service was not found.
|
||||
*/
|
||||
|
@ -312,12 +314,14 @@ class Services_model extends EA_Model {
|
|||
/**
|
||||
* Get all, or specific records from service's table.
|
||||
*
|
||||
* @param string $whereClause (OPTIONAL) The WHERE clause of
|
||||
* the query to be executed. DO NOT INCLUDE 'WHERE' KEYWORD.
|
||||
*
|
||||
* @return array Returns the rows from the database.
|
||||
* @example $this->Model->getBatch('id = ' . $recordId);
|
||||
*
|
||||
* @param mixed $where
|
||||
* @param mixed $order_by
|
||||
* @param int|null $limit
|
||||
* @param int|null $offset
|
||||
*
|
||||
* @return array Returns the rows from the database.
|
||||
*/
|
||||
public function get_batch($where = NULL, $order_by = NULL, $limit = NULL, $offset = NULL)
|
||||
{
|
||||
|
@ -475,6 +479,11 @@ class Services_model extends EA_Model {
|
|||
/**
|
||||
* Get all service category records from database.
|
||||
*
|
||||
* @param mixed $where
|
||||
* @param mixed $order_by
|
||||
* @param int|null $limit
|
||||
* @param int|null $offset
|
||||
*
|
||||
* @return array Returns an array that contains all the service category records.
|
||||
*/
|
||||
public function get_all_categories($where = NULL, $order_by = NULL, $limit = NULL, $offset = NULL)
|
||||
|
|
Loading…
Reference in a new issue