Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dot notation in key name #71

Closed
benrolfe opened this issue Jun 11, 2018 · 3 comments
Closed

Dot notation in key name #71

benrolfe opened this issue Jun 11, 2018 · 3 comments

Comments

@benrolfe
Copy link

I'm passing through the following search criteria, but it's only searching by my name "Ben", the company name is being ignored. How do I use dot notation?

[
    'Name'  => 'Ben',
    'Company.Name'  => 'Nike',
]

Here's my PHP code:

// works
public function name($value)
{
    return $this->where('Name', 'LIKE', "%$value%");
}

// ignored
public function companyName($value)
{
    return $this->related('company', 'Name', 'LIKE', "%$value%");
}
@Tucker-Eric
Copy link
Owner

This currently is not supported but I'd be happy to merge this feature if you submitted a pr for it.

@benrolfe
Copy link
Author

@Tucker-Eric Do you know what the issue is? Is the key ignored because of the dot? Does it throw a silent error? Does it try to match against an odd/invalid method name (eg: company.Name())?

@Tucker-Eric
Copy link
Owner

Yup, it tries to match an invalid method name company.Name(). Looks like Laravel's camel_case helper method doesn't strip dots.

I've just updated and published fix in 1.3.1. You should be good to go with those updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants