Comments (3)
You could do something like this:
send a GET to "/your-endpoint?query=" + encodeURIComponent(JSON.stringify(yourQueryObject))
then on backend:
$router->get('/your-endpoint', function (\Illuminate\Http\Request $request, \Williamoliveira\ArrayQueryBuilder\ArrayBuilder $arrayBuilder) {
$yourQueryObject = json_decode($request->get('query'));
$query = User::query();
$query = $arrayBuilder->apply($query, $yourQueryObject);
return $query->paginate($request->get('per_page'));
});
another approach, the one I use, is to convert the query object to query string using https://github.com/ljharb/qs
from eloquent-array-query-builder.
Hi,
Just put all where conditions in the same object
query = {
where:{
created_at:{
between:['2014-10-10','2015-10-10']
},
name:{
like:'%joao%'
}
}
}
from eloquent-array-query-builder.
Thanks for your answer but when I define a object in JavaScript, I had to define just one where
property and doesn't define multiple where
property. How to handle like this:
query = {
where:{
created_at:{
between:['2014-10-10','2015-10-10']
}
},
where:{
name:{
like:'%joao%'
}
}
}
and error me in my editor duplicate declaration and in run time:
console.log(decodeURIComponent($httpParamSerializerJQLike(query)));
print where[name][like]=%joao%
How to solve it?
from eloquent-array-query-builder.
Related Issues (12)
- How to and two query with like? HOT 1
- relation not working HOT 12
- Installation failed, reverting ./composer.json to its original content HOT 5
- Support Laravel 5.8 HOT 3
- Support Laravel 6.0 and 7.0 HOT 2
- Idea: Build query array from existing Eloquent QueryBuilder
- How to AND , OR two condition to each other HOT 2
- groupBy in array query builder HOT 3
- Is it possible to add SUM, MAX, MIN, AVG, COUNT to query builder HOT 6
- Support Laravel 5.3 HOT 4
- Support Laravel 5.4 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eloquent-array-query-builder.