Git Product home page Git Product logo

laravel-api-query-builder's People

Contributors

darksaboteur avatar selahattinunlu avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

aimalazmi

laravel-api-query-builder's Issues

Filtering with AND on relations

Hello,

Can you tell if it is possible to filter on a relation attribute using an AND. For instance, is it possible to filter the users to get every users with admin role AND publisher role ? With a request like this one:

/api/v1/users?role[]=admin&role[]=publisher

Or let's say that the admin role has ID 1 and the publisher role has ID 3, with something like:

/api/v1/users?role[]=1&role[]=3

If I issue this I get every users with admin role OR publisher role OR both.
This package craft the following query:

select users.* from userswhere exists (select * fromrolesinner joinusers_rolesonroles.id=users_roles.role_idwhereusers.id=users_roles.user_id and (roles.idin (1, 3))) order byusers.id desc

But it should craft the following one:

select users.* from userswhere exists (select * fromrolesinner joinusers_rolesonroles.id=users_roles.role_idwhereusers.id=users_roles.user_id and (roles.idin (1))) and exists (select * fromrolesinner joinusers_rolesonroles.id=users_roles.role_idwhereusers.id=users_roles.user_id and (roles.idin (3))) order byusers.id desc

Have you manage to do it yet or should I modify this package ?

Thank you in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.