Skip to content

Commit

Permalink
strip dots from method names
Browse files Browse the repository at this point in the history
  • Loading branch information
Tucker-Eric committed Jun 12, 2018
1 parent cdf78b8 commit 1368bea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ModelFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public function related($relation, $column, $operator = null, $value = null, $bo
*/
public function getFilterMethod($key)
{
return camel_case($this->drop_id ? preg_replace('/^(.*)_id$/', '$1', $key) : $key);
return camel_case(str_replace('.', '', $this->drop_id ? preg_replace('/^(.*)_id$/', '$1', $key) : $key));
}

/**
Expand Down
3 changes: 3 additions & 0 deletions tests/ModelFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ public function testGetFilterMethod()
'name' => 'name',
'first_name' => 'firstName',
'first_or_last_name' => 'firstOrLastName',
// Test dot-notation works
'Company.Name' => 'companyName',
'Company-Name' => 'companyName'
];

foreach ($input as $key => $method) {
Expand Down

0 comments on commit 1368bea

Please sign in to comment.