darksaboteur / laravel-api-query-builder Goto Github PK
View Code? Open in Web Editor NEWThis project forked from selahattinunlu/laravel-api-query-builder
Laravel Api Query Builder Package
This project forked from selahattinunlu/laravel-api-query-builder
Laravel Api Query Builder Package
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 * from
rolesinner join
users_roleson
roles.
id=
users_roles.
role_idwhere
users.
id=
users_roles.
user_idand (
roles.
idin (1, 3))) order by
users.
iddesc
But it should craft the following one:
select
users.* from
userswhere exists (select * from
rolesinner join
users_roleson
roles.
id=
users_roles.
role_idwhere
users.
id=
users_roles.
user_idand (
roles.
idin (1))) and exists (select * from
rolesinner join
users_roleson
roles.
id=
users_roles.
role_idwhere
users.
id=
users_roles.
user_idand (
roles.
idin (3))) order by
users.
iddesc
Have you manage to do it yet or should I modify this package ?
Thank you in advance.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.