コード例 #1
0
 /**
  * Get a plain attribute (not a relationship).
  *
  * @param  string $key
  *
  * @return mixed
  */
 protected function getAttributeValue($key)
 {
     $value = $this->getAttributeFromArray($key);
     // If the attribute has a get mutator, we will call that then return what
     // it returns as the value, which is useful for transforming values on
     // retrieval from the model to a form that is more useful for usage.
     if ($this->hasGetMutator($key)) {
         return $this->mutateAttribute($key, $value);
     } elseif (in_array($key, $this->getDates())) {
         if ($value) {
             return $this->asDateTime($value);
         }
     } elseif (!is_null(\Config::get('rets.rets_property.' . $key . '.matadata_id', null))) {
         $ids = explode(',', $value);
         $values = RetsField::where('lookup_id', \Config::get('rets.rets_property.' . $key . '.matadata_id', null))->whereIn('id', $ids)->get();
         if ($values->isEmpty()) {
             return $value;
         }
         return $values;
     }
     return $value;
 }