Comments (4)
Sample format would be like this:
[
{
"meta_total_count": 10,
"meta_filter_count": 0,
"meta_response":
{
"id": "1",
"code": "est",
"name": "Est et.",
"status": "0",
"created_by": "minus",
"updated_by": null,
"created_at": "2014-04-19 02:03:37",
"updated_at": "2014-04-19 02:03:37",
"deleted_at": null
}
}
]
from laravel-api-handler.
I thought a lot about this and I decided to first support the meta information in the http headers. However I may indeed add this optional feature in the future. There are multiple ways to do this.
I could support an additional parameter in getResponse()
or an option in the package config which allows the developer to decide what he wants. Or use a flag like _config=envelope
where the client can decide In which form he wants the data.
This of course isn't implemented right now. With the tools available right now you can still manually implement an envelope. This is however not that clean but it works:
$result = ApiHandler::parseMultiple($foo, array('foo', 'bar'));
$builder = $result->getBuilder();
$metaProviders = $result->getMetaProviders();
$response = array();
foreach($metaProviders as $provider) {
if($provider->getTitle() == 'Meta-Total-Count') $response['meta_total_count'] = $provider->get();
else if($provider->getTitle() == 'Meta-Filter-Count') $response['meta_filter_count'] = $provider->get();
}
$response['data'] = $builder->get();
return $response;
from laravel-api-handler.
Thanks, it just shows the flexibility that you have implemented this handler in a way to make it open for modification.
Once again thank you for considering my request.
from laravel-api-handler.
Lets keep this issue open. I'll close it when there is a more sophisticated solution.
from laravel-api-handler.
Related Issues (20)
- Add offset, limit and filter to meta HOT 1
- Predefined filter partially not working ? HOT 6
- Transformers / Include related models HOT 1
- Sorting datetime field HOT 4
- Why parseSingle HOT 2
- Returning relationship model data even when not requested when Accessor is used in model HOT 1
- The last version not working with larave 5.3 HOT 2
- better if this package support more than two layer "_fields" nesting HOT 1
- Is there any chance to use with Doctrine?
- Not able to use on Lumen without Facades HOT 1
- Great job! HOT 1
- Non-static method Marcelgwerder\\ApiHandler\\ApiHandler::parseMultiple() should not be called statically HOT 2
- Search in joined table HOT 9
- Support for Laravel 5.5 Resources HOT 1
- [question] Use library with repository HOT 2
- How can i use custom get param HOT 3
- Proposal - Appends HOT 1
- Security question HOT 1
- Allow to selectively use soft-deleted entities HOT 1
- [Next] Setting sortable columns does not work properly
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 laravel-api-handler.