Skip to content

Commit

Permalink
fixed issue with entity property mutators studly case
Browse files Browse the repository at this point in the history
  • Loading branch information
smallhadroncollider committed Aug 2, 2016
1 parent 8f5aa67 commit c0f6eed
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ protected function hasSetMutator($key)
*/
protected function getMutatorMethod($key)
{
return ucfirst($key) . 'Attribute';
$key = ucwords(str_replace(['-', '_'], ' ', $key));
return str_replace(' ', '', $key) . "Attribute";
}

/**
Expand All @@ -101,7 +102,7 @@ public function toArray()
// First, call the trait method before filtering
// with Entity specific methods
$attributes = $this->attributesToArray($this->attributes);

foreach ($this->attributes as $key => $attribute) {
if (in_array($key, $this->hidden)) {
unset($attributes[$key]);
Expand Down

0 comments on commit c0f6eed

Please sign in to comment.