Beispiel #1
0
 /**
  * Convert a value to camel case.
  *
  * @param  string  $value
  * @return string
  */
 function camel_case($value)
 {
     return Str::camel($value);
 }
Beispiel #2
0
 /**
  * Attempt to guess the name of the inverse of the relation.
  *
  * @return string
  */
 protected function guessInverseRelation()
 {
     $relation = Str::plural(class_basename($this->getParent()));
     return Str::camel($relation);
 }
Beispiel #3
0
 /**
  * Get an attribute from the model.
  *
  * @param  string  $key
  * @return mixed
  */
 public function getAttribute($key)
 {
     $inAttributes = array_key_exists($key, $this->attributes);
     if ($inAttributes || $this->hasGetMutator($key)) {
         return $this->getAttributeValue($key);
     }
     if (array_key_exists($key, $this->relations)) {
         return $this->relations[$key];
     }
     $camelKey = Str::camel($key);
     if (method_exists($this, $camelKey)) {
         return $this->getRelationshipFromMethod($key, $camelKey);
     }
 }