/** * Convert a value to camel case. * * @param string $value * @return string */ function camel_case($value) { return Str::camel($value); }
/** * 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); }
/** * 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); } }