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

Implicit where has with where method. #198

Closed
josephmancuso opened this issue Oct 19, 2020 · 1 comment
Closed

Implicit where has with where method. #198

josephmancuso opened this issue Oct 19, 2020 · 1 comment
Labels
enhancement A feature that exists, works as intended but needs to be improved feature request A feature that does not yet exist but will be a good addition to the library

Comments

@josephmancuso
Copy link
Member

I saw this syntax in a PHP package and love it:

$posts =
    Post::where('author.name', 'John')
        ->take(10)
        ->get();

This is the same as:

User.where_has('author', lambda q: q.where('name', 'John'))

I feel like we can easily detect a dot notation in the where method and explode it out to a wherehas

@josephmancuso josephmancuso added enhancement A feature that exists, works as intended but needs to be improved feature request A feature that does not yet exist but will be a good addition to the library labels Oct 19, 2020
@josephmancuso
Copy link
Member Author

we just have to watch because i think we use this syntax already for tables? will have to check

Phase 4 - Feature Requests & Maintenance Phase automation moved this from To do to Done Oct 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A feature that exists, works as intended but needs to be improved feature request A feature that does not yet exist but will be a good addition to the library
Projects
No open projects
Development

No branches or pull requests

1 participant