get() public static method

Gets a service by id.
public static get ( string $reference ) : object
$reference string The service id
return object The service
 public function get($type, array $params = array())
 {
     $url = self::METHOD_PATH . '/' . $type;
     $paramsString = $this->parseParams($params);
     $url .= $paramsString != '' ? '?' . $paramsString : '';
     return parent::get($url);
 }
 public function get(array $params = array())
 {
     $url = self::METHOD_PATH;
     $paramsString = $this->parseParams($params);
     $url .= $paramsString != "" ? "?" . $paramsString : "";
     return parent::get(self::METHOD_PATH);
 }
 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     $solicitor = Solicitor::model()->findByPk($model->solicitor_id);
     $lists = BaseModel::getAll('Solicitor');
     $solicitors = array();
     foreach ($lists as $list) {
         $solicitors[$list->id] = $list->first_name . ' ' . $list->last_name . '(' . $list->solicitor_code . ')';
     }
     if (isset($_GET['visit'])) {
         $v_id = $_GET['visit'];
         $visit = BaseModel::get('Visits', array("condition" => "id = '{$v_id}'"));
         if ($visit !== null) {
             $model->visit_id = $visit->id;
             $model->solicitor_id = $visit->solicitor_id;
         }
     }
     $visits = CHtml::listData(Visits::model()->findAll(), 'id', 'visit_code');
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['SolicitorCredit'])) {
         $model->attributes = $_POST['SolicitorCredit'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('update', array('model' => $model, 'solicitor' => $solicitor, 'solicitors' => $solicitors, 'visits' => $visits));
 }
 public function get($login = null)
 {
     $url = self::METHOD_PATH;
     if ($login !== null) {
         $url .= '/' . $login;
     }
     return parent::get($url);
 }
 public function get($group = 0)
 {
     $this->ensureInteger($group);
     $url = self::METHOD_PATH;
     if ($group > 0) {
         $url .= '/' . $group;
     }
     return parent::get($url);
 }
 public function get($type, $params = array())
 {
     $url = 'reports/' . $type;
     $this->encodeParams($params);
     $params = $this->parseParams($params);
     $paramsString = http_build_query($params);
     $url .= $paramsString != "" ? "?" . $paramsString : "";
     return parent::get($url);
 }
Example #7
0
 public function get($group = 0)
 {
     $group = (int) $group;
     $url = 'groups';
     if ($group !== 0) {
         $url .= '/' . $group;
     }
     return parent::get($url);
 }
Example #8
0
 public function get($group = 0)
 {
     $group = (int) $group;
     $url = 'status';
     if ($group !== 0) {
         $url .= '/' . $group;
     }
     $status = parent::get($url);
     return $status->status;
 }
Example #9
0
 /**
  * {@inheritdoc}
  *
  * @return static
  */
 public static function get($id)
 {
     if (is_object($id)) {
         return parent::get($id);
     }
     $cache = Service::getModelCache();
     $id = (int) $id;
     if (!$cache) {
         // There is no cache, just get the model
         return parent::get($id);
     }
     if ($model = self::getFromCache($id)) {
         // The model exists in the cache, return that to the caller
         return $model;
     } else {
         return parent::get($id)->storeInCache();
     }
 }
 function get_promotion_price($goods_id, $spec_id)
 {
     if (!$goods_id || !$spec_id) {
         return 0;
     }
     $spec_mod =& m('goodsspec');
     $spec = $spec_mod->get(array('conditions' => 'goods_id=' . $goods_id . ' AND spec_id=' . $spec_id, 'fields' => 'price'));
     $price = $old_price = $spec['price'];
     $promotion = parent::get(array('conditions' => "start_time<=" . gmtime() . " AND end_time>=" . gmtime() . " AND goods_id=" . $goods_id, 'fields' => 'spec_price'));
     if (!empty($promotion)) {
         $spec_price = unserialize($promotion['spec_price']);
         if ($spec_price[$spec_id]['is_pro'] == 1) {
             if ($spec_price[$spec_id]['pro_type'] == 'price') {
                 $pro_price = round($old_price - $spec_price[$spec_id]['price'], 2);
                 if ($pro_price > 0) {
                     $price = $pro_price;
                 }
             } else {
                 $price = round($old_price * $spec_price[$spec_id]['price'] / 1000, 4) * 100;
             }
         }
     }
     return $price;
 }
 /**
  * Get value(s) for specified attribute. $ps_field specifies the value to fetch in <table_name>.<element_code> or <table_name>.<element_code>.<subelement_code>
  * Will return a string containing the retrieved value or values (since attributes can repeat). The values will
  * be formatted using the 'template' option with values separated by a delimiter as set in the 'delimiter'
  * option (default is a space). 
  *
  * If the 'returnAsArray' option is set the an array containing all values will be returned.
  * The array will be keyed on the current row primary key, and then attribute_id, with each attribute_id value containing an array keyed on element code and having
  * values set to attribute values (this is a bit more complicated than one might hope since not only can
  * values repeat, but they can be composed of many sub-values... the final array key'ed on element_code may have several values if the attribute is complex). 
  *
  * If the 'returnAllLocales' option is set *and* 'returnAsArray' is set then the returned array will include an extra dimension (or key if that's what you prefer to call it)
  * that separates values by numeric locale_id. Thus the returned array will have several layers of keys: current row primary key, then locale_id, then attribute_id and then
  * finally, element codes. This format is, incidentally, compatible with the caExtractValuesByUserLocale() helper function, which would strip all values not needed for
  * display in the current locale.
  *
  * @param $pa_options array - array of options for get; in addition to the standard get() options, will also pass through options to attribute value handlers
  *		Supported options include:
  *			locale = 
  *			returnAsArray = if true, return an array, otherwise return a string (default is false)
  *			returnAllLocales = 
  *			template = 
  *			delimiter = 
  *			convertCodesToDisplayText =
  *			returnAsLink = if true and $ps_field is a URL attribute and returnAllLocales is not set, then returned values will be links. Default is false.
  *			returnAsLinkText = *For URL attributes only* Text to use a content of HTML link. If omitted the url itself is used as the link content. 	 	 
  *			returnAsLinkAttributes = array of attributes to include in link <a> tag. Use this to set class, alt and any other link attributes.
  *
  * @return mixed - 
  *
  * 
  */
 public function get($ps_field, $pa_options = null)
 {
     if (!is_array($pa_options)) {
         $pa_options = array();
     }
     $vs_template = isset($pa_options['template']) ? $pa_options['template'] : null;
     $vs_delimiter = isset($pa_options['delimiter']) ? $pa_options['delimiter'] : ' ';
     $vb_return_as_array = isset($pa_options['returnAsArray']) ? (bool) $pa_options['returnAsArray'] : false;
     $vb_return_all_locales = isset($pa_options['returnAllLocales']) ? (bool) $pa_options['returnAllLocales'] : false;
     $vb_return_as_link = isset($pa_options['returnAsLink']) ? (bool) $pa_options['returnAsLink'] : false;
     $vs_return_as_link_text = isset($pa_options['returnAsLinkText']) ? (string) $pa_options['returnAsLinkText'] : '';
     $vs_return_as_link_attributes = isset($pa_options['returnAsLinkAttributes']) ? (string) $pa_options['returnAsLinkAttributes'] : array();
     if ($vb_return_all_locales && !$vb_return_as_array) {
         $vb_return_as_array = true;
     }
     if (!isset($pa_options['convertCodesToDisplayText'])) {
         $pa_options['convertCodesToDisplayText'] = false;
     }
     // does get refer to an attribute?
     $va_tmp = explode('.', $ps_field);
     $pa_options = array_merge($pa_options, array('indexByRowID' => true));
     // force arrays to be indexed by current row_id
     $t_instance = $this;
     if (sizeof($va_tmp) >= 2 && !$this->hasField($va_tmp[2])) {
         if ($va_tmp[1] == 'parent' && $this->isHierarchical() && ($vn_parent_id = $this->get($this->getProperty('HIERARCHY_PARENT_ID_FLD')))) {
             $t_instance = $this->getAppDatamodel()->getInstanceByTableNum($this->tableNum());
             if (!$t_instance->load($vn_parent_id)) {
                 $t_instance = $this;
             } else {
                 unset($va_tmp[1]);
                 $va_tmp = array_values($va_tmp);
             }
         } else {
             if ($va_tmp[1] == 'children' && $this->isHierarchical()) {
                 unset($va_tmp[1]);
                 // remove 'children' from field path
                 $va_tmp = array_values($va_tmp);
                 $vs_childless_path = join('.', $va_tmp);
                 $va_data = array();
                 $va_children_ids = $this->getHierarchyChildren(null, array('idsOnly' => true));
                 $t_instance = $this->getAppDatamodel()->getInstanceByTableNum($this->tableNum());
                 foreach ($va_children_ids as $vn_child_id) {
                     if ($t_instance->load($vn_child_id)) {
                         $vm_val = $t_instance->get($vs_childless_path, $pa_options);
                         $va_data = array_merge($va_data, is_array($vm_val) ? $vm_val : array($vm_val));
                     }
                 }
                 if ($vb_return_as_array) {
                     return $va_data;
                 } else {
                     return join($vs_delimiter, $va_data);
                 }
             }
         }
     }
     switch (sizeof($va_tmp)) {
         # -------------------------------------
         case 1:
             // simple name
             if (!$t_instance->hasField($va_tmp[0])) {
                 // is it intrinsic?
                 // nope... so try it as an attribute
                 if (!$vb_return_as_array) {
                     return $t_instance->getAttributesForDisplay($va_tmp[0], $vs_template, $pa_options);
                 } else {
                     $va_values = $t_instance->getAttributeDisplayValues($va_tmp[0], $t_instance->getPrimaryKey(), $pa_options);
                     if (!$vb_return_all_locales) {
                         $va_values = array_shift($va_values);
                     }
                     return $va_values;
                 }
             }
             break;
             # -------------------------------------
         # -------------------------------------
         case 2:
             // table_name.field_name
             if ($va_tmp[0] === $t_instance->tableName()) {
                 if (!$t_instance->hasField($va_tmp[1]) && $va_tmp[1] != 'created' && $va_tmp[1] != 'lastModified') {
                     // try it as an attribute
                     if (!$vb_return_as_array) {
                         return $t_instance->getAttributesForDisplay($va_tmp[1], $vs_template, $pa_options);
                     } else {
                         $va_values = $t_instance->getAttributeDisplayValues($va_tmp[1], $vn_row_id = $t_instance->getPrimaryKey(), $pa_options);
                         if (!$vb_return_all_locales) {
                             $va_values = array_shift($va_values);
                             if ($vs_template) {
                                 $va_values_tmp = array();
                                 foreach ($va_values as $vn_i => $va_value_list) {
                                     $va_values_tmp[] = caProcessTemplateForIDs($vs_template, $va_tmp[0], array($vn_row_id), array_merge($pa_options, array('returnAsArray' => false, 'placeholderPrefix' => $va_tmp[1])));
                                 }
                                 $va_values = $va_values_tmp;
                             }
                         }
                         return $va_values;
                     }
                 }
             }
             break;
             # -------------------------------------
         # -------------------------------------
         case 3:
             // table_name.field_name.sub_element / table_name.field_name.hierarchy
         // table_name.field_name.sub_element / table_name.field_name.hierarchy
         case 4:
             // table_name.field_name.sub_element.hierarchy
             if (!$this->hasField($va_tmp[2]) || $va_tmp[2] === 'hierarchy') {
                 if ($va_tmp[0] === $t_instance->tableName()) {
                     $vb_is_in_container = false;
                     if (!$this->hasField($va_tmp[1])) {
                         if ($va_tmp[2] === 'hierarchy' || $va_tmp[3] === 'hierarchy') {
                             if ($va_tmp[3] === 'hierarchy') {
                                 $vb_is_in_container = true;
                             }
                             if (in_array($this->_getElementDatatype($vb_is_in_container ? $va_tmp[2] : $va_tmp[1]), array(__CA_ATTRIBUTE_VALUE_LIST__))) {
                                 $va_items = $this->get(join('.', $vb_is_in_container ? array($va_tmp[0], $va_tmp[1], $va_tmp[2]) : array($va_tmp[0], $va_tmp[1])), array('returnAsArray' => true));
                                 $va_item_ids = $va_item_ids = caExtractValuesFromArrayList($va_items, $vb_is_in_container ? $va_tmp[2] : $va_tmp[1], array('preserveKeys' => false));
                                 $qr_items = caMakeSearchResult('ca_list_items', $va_item_ids);
                                 if (!$va_item_ids || !is_array($va_item_ids) || !sizeof($va_item_ids)) {
                                     return $vb_return_as_array ? array() : null;
                                 }
                                 $va_get_spec = $va_tmp;
                                 array_shift($va_get_spec);
                                 array_shift($va_get_spec);
                                 if ($vb_is_in_container) {
                                     array_shift($va_get_spec);
                                 }
                                 array_unshift($va_get_spec, 'ca_list_items');
                                 $vs_get_spec = join('.', $va_get_spec);
                                 $va_vals = array();
                                 while ($qr_items->nextHit()) {
                                     $va_hier = $qr_items->get($vs_get_spec, array('returnAsArray' => true));
                                     array_shift($va_hier);
                                     // get rid of root
                                     $va_vals[] = $vb_return_as_array ? $va_hier : join($vs_delimiter, $va_hier);
                                 }
                                 return $va_vals;
                             }
                         }
                     }
                     if (!$t_instance->hasField($va_tmp[1])) {
                         // try it as an attribute
                         if (!$vb_return_as_array) {
                             if (!$vs_template) {
                                 $vs_template = '^' . $va_tmp[2];
                             }
                             return $t_instance->getAttributesForDisplay($va_tmp[1], $vs_template, $pa_options);
                         } else {
                             $va_values = $t_instance->getAttributeDisplayValues($va_tmp[1], $vn_row_id = $t_instance->getPrimaryKey(), $pa_options);
                             $va_subvalues = array();
                             if ($vb_return_all_locales) {
                                 foreach ($va_values as $vn_attribute_id => $va_attributes_by_locale) {
                                     foreach ($va_attributes_by_locale as $vn_locale_id => $va_attribute_values) {
                                         foreach ($va_attribute_values as $vn_attribute_id => $va_data) {
                                             if (isset($va_data[$va_tmp[2]])) {
                                                 $va_subvalues[$vn_attribute_id][(int) $vn_locale_id][$vn_attribute_id] = $va_data[$va_tmp[2]];
                                             }
                                         }
                                     }
                                 }
                             } else {
                                 foreach ($va_values as $vn_id => $va_attribute_values) {
                                     foreach ($va_attribute_values as $vn_attribute_id => $va_data) {
                                         if (isset($va_data[$va_tmp[2]])) {
                                             if ($vs_template) {
                                                 $va_subvalues[$vn_attribute_id] = caProcessTemplateForIDs($vs_template, $va_tmp[0], array($vn_row_id), array_merge($pa_options, array('requireLinkTags' => true, 'returnAsArray' => false, 'placeholderPrefix' => $va_tmp[1])));
                                             } else {
                                                 $va_subvalues[$vn_attribute_id] = $va_data[$va_tmp[2]];
                                             }
                                         }
                                     }
                                 }
                             }
                             return $va_subvalues;
                         }
                     }
                 }
             }
             break;
             # -------------------------------------
     }
     return parent::get($ps_field, $pa_options);
 }
 /**
  * 
  */
 public function getTypeID($pn_id = NULL)
 {
     if ($pn_id) {
         $qr_res = $this->getDb()->query("SELECT type_id FROM " . $this->tableName() . " WHERE " . $this->primaryKey() . " = ?", array((int) $pn_id));
         if ($qr_res->nextRow()) {
             return $qr_res->get('type_id');
         }
         return null;
     }
     return BaseModel::hasField('type_id') ? BaseModel::get('type_id') : null;
 }
Example #13
0
 public function get($login = null)
 {
     $url = 'agents' . (null !== $login ? '/' . $login : '');
     return parent::get($url);
 }
 /**
  * Called just after record is deleted. Individual editor controllers can override this to implement their
  * own post-deletion cleanup logic.
  *
  * @param BaseModel $pt_subject Model instance of row that was deleted
  * @return bool True if post-deletion cleanup was successful, false if not
  */
 protected function _checkAccess($pt_subject, $pa_options = null)
 {
     //
     // Is record deleted?
     //
     if ($pt_subject->hasField('deleted') && $pt_subject->get('deleted')) {
         if (!caGetOption('dontRedirectOnDelete', $pa_options, false)) {
             $this->response->setRedirect($this->request->config->get('error_display_url') . '/n/2550?r=' . urlencode($this->request->getFullUrlPath()));
         }
         return false;
     }
     //
     // Is record of correct type?
     //
     $va_restrict_to_types = null;
     if ($pt_subject->getAppConfig()->get('perform_type_access_checking')) {
         $va_restrict_to_types = caGetTypeRestrictionsForUser($this->ops_table_name, array('access' => __CA_BUNDLE_ACCESS_READONLY__));
     }
     if (is_array($va_restrict_to_types) && ($pt_subject->get('type_id') && ($pt_subject->getPrimaryKey() && !in_array($pt_subject->get('type_id'), $va_restrict_to_types)))) {
         $this->response->setRedirect($this->request->config->get('error_display_url') . '/n/2560?r=' . urlencode($this->request->getFullUrlPath()));
         return false;
     }
     //
     // Is record from correct source?
     //
     $va_restrict_to_sources = null;
     if ($pt_subject->getAppConfig()->get('perform_source_access_checking') && $pt_subject->hasField('source_id')) {
         if (is_array($va_restrict_to_sources = caGetSourceRestrictionsForUser($this->ops_table_name, array('access' => __CA_BUNDLE_ACCESS_READONLY__)))) {
             if (!$pt_subject->get('source_id') || $pt_subject->get('source_id') && !in_array($pt_subject->get('source_id'), $va_restrict_to_sources) || strlen($vn_source_id = $this->request->getParameter('source_id', pInteger)) && !in_array($vn_source_id, $va_restrict_to_sources)) {
                 $pt_subject->set('source_id', $pt_subject->getDefaultSourceID(array('request' => $this->request)));
             }
             if (is_array($va_restrict_to_sources) && !in_array($pt_subject->get('source_id'), $va_restrict_to_sources)) {
                 $this->response->setRedirect($this->request->config->get('error_display_url') . '/n/2562?r=' . urlencode($this->request->getFullUrlPath()));
                 return;
             }
         }
     }
     //
     // Does user have access to row?
     //
     if ($pt_subject->getAppConfig()->get('perform_item_level_access_checking') && $vn_subject_id) {
         if ($pt_subject->checkACLAccessForUser($this->request->user) < __CA_BUNDLE_ACCESS_READONLY__) {
             $this->response->setRedirect($this->request->config->get('error_display_url') . '/n/2580?r=' . urlencode($this->request->getFullUrlPath()));
             return false;
         }
     }
     return true;
 }
 public function get()
 {
     return parent::get('visitors');
 }
 /**
  * Overrides get() to support bundleable-level fields (relationships)
  *
  * Options:
  *		All supported by BaseModelWithAttributes::get() plus:
  *		retrictToRelationshipTypes - array of ca_relationship_types.type_id values to filter related items on. *MUST BE INTEGER TYPE_IDs, NOT type_code's* This limitation is for performance reasons. You have to convert codes to integer type_id's before invoking get
  *		sort = optional array of bundles to sort returned values on. Currently only supported when getting related values via simple related <table_name> and <table_name>.related invokations. Eg. from a ca_objects results you can use the 'sort' option got get('ca_entities'), get('ca_entities.related') or get('ca_objects.related'). The bundle specifiers are fields with or without tablename. Only those fields returned for the related tables (intrinsics and label fields) are sortable. You cannot sort on attributes.
  *		returnAsLink = if true and $ps_field is set to a specific field in a related table, or $ps_field is set to a related table (eg. ca_entities or ca_entities.related) AND the template option is set and returnAllLocales is not set, then returned values will be links. The destination of the link will be the appropriate editor when executed within Providence or the appropriate detail page when executed within Pawtucket or another front-end. Default is false.
  *		returnAsLinkText = text to use a content of HTML link. If omitted the url itself is used as the link content.
  *		returnAsLinkAttributes = array of attributes to include in link <a> tag. Use this to set class, alt and any other link attributes.
  *		returnAsLinkTarget = Optional link target. If any plugin implementing hookGetAsLink() responds to the specified target then the plugin will be used to generate the links rather than CA's default link generator.
  */
 public function get($ps_field, $pa_options = null)
 {
     if ($this->hasField($ps_field)) {
         return BaseModel::get($ps_field, $pa_options);
     }
     if ($this->_rowAsSearchResult) {
         return $this->_rowAsSearchResult->get($ps_field, $pa_options);
     }
     return null;
 }
 public function getSingleResponse($id)
 {
     $id = (int) $id;
     $url = 'canned_responses/' . $id;
     return parent::get($url);
 }
 public function getSingleTicket($ticketId)
 {
     $url = self::METHOD_PATH . '/' . $ticketId;
     return parent::get($url);
 }
 /**
  * 
  */
 public function getTypeID()
 {
     return BaseModel::get('type_id');
 }
 /**
  * 
  */
 public function getTypeID()
 {
     return BaseModel::hasField('type_id') ? BaseModel::get('type_id') : null;
 }
 /**
  * Overrides get() to support bundleable-level fields (relationships)
  *
  * Options:
  *		All supported by BaseModelWithAttributes::get() plus:
  *		retrictToRelationshipTypes - array of ca_relationship_types.type_id values to filter related items on. *MUST BE INTEGER TYPE_IDs, NOT type_code's* This limitation is for performance reasons. You have to convert codes to integer type_id's before invoking get
  *		sort = optional array of bundles to sort returned values on. Currently only supported when getting related values via simple related <table_name> and <table_name>.related invokations. Eg. from a ca_objects results you can use the 'sort' option got get('ca_entities'), get('ca_entities.related') or get('ca_objects.related'). The bundle specifiers are fields with or without tablename. Only those fields returned for the related tables (intrinsics and label fields) are sortable. You cannot sort on attributes.
  *		returnAsLink = if true and $ps_field is set to a specific field in a related table, or $ps_field is set to a related table (eg. ca_entities or ca_entities.related) AND the template option is set and returnAllLocales is not set, then returned values will be links. The destination of the link will be the appropriate editor when executed within Providence or the appropriate detail page when executed within Pawtucket or another front-end. Default is false.
  *		returnAsLinkText = text to use a content of HTML link. If omitted the url itself is used as the link content.
  *		returnAsLinkAttributes = array of attributes to include in link <a> tag. Use this to set class, alt and any other link attributes.
  *		returnAsLinkTarget = Optional link target. If any plugin implementing hookGetAsLink() responds to the specified target then the plugin will be used to generate the links rather than CA's default link generator.
  */
 public function get($ps_field, $pa_options = null)
 {
     $vn_s = sizeof($va_tmp = explode('.', $ps_field));
     if ($vn_s == 1 && ($vs_field = $ps_field) || $vn_s == 2 && $va_tmp[0] == $this->TABLE && ($vs_field = $va_tmp[1])) {
         if ($this->hasField($vs_field)) {
             return BaseModel::get($vs_field, $pa_options);
         }
     }
     if ($this->_rowAsSearchResult) {
         return $this->_rowAsSearchResult->get($ps_field, $pa_options);
     }
     return null;
 }
Example #22
0
 public function getSingleChat($chatId)
 {
     $this->ensureInteger($chatId);
     $url = self::METHOD_PATH . '/' . $chatId;
     return parent::get($url);
 }
 /**
  * @param BaseModel $po_model_instance
  * @param string $ps_field_name
  * @return string normalised idno
  */
 private function makeIDNOFromInstance($po_model_instance, $ps_field_name)
 {
     $va_length = $po_model_instance->getFieldInfo($ps_field_name, 'BOUNDS_LENGTH');
     // Previously this was always 30, so let's be conservative
     $vn_max_length = isset($va_length[1]) ? $va_length[1] : 30;
     $vs_value = $po_model_instance->get($ps_field_name);
     return $this->makeIDNO($vs_value, $vn_max_length);
 }
 public function getSingleResponse($id)
 {
     $this->ensureInteger($id);
     $url = self::METHOD_PATH . '/' . $id;
     return parent::get($url);
 }
Example #25
0
 public function testGetMethod()
 {
     $stub = $this->getMockBuilder('BaseModel')->disableOriginalConstructor()->getMock();
     $this->assertEquals($stub, BaseModel::get($stub));
 }
Example #26
0
 /**
  * Get a model's data from the database
  */
 private function getFromDatabase()
 {
     parent::get($this->id);
     if ($this->loaded) {
         // Reload the lazy parameters of the model if they're loaded already
         $this->lazyLoad(true);
     }
 }
Example #27
0
 public function getSingleChat($chatId)
 {
     $url = 'chats/' . $chatId;
     return parent::get($url);
 }