Giter Club home page Giter Club logo

Comments (4)

MarcinOrlowski avatar MarcinOrlowski commented on September 23, 2024

Hi,

Thanks for the suggestion. I just added support for Eloquent model in dev-master branch (so checkout and try). Also you can now pass anything to be returned as payload, not just arrays (however not always it makes sense, as I still need to convert it to return object as per specification, but at least you can do that if needed). Let me know how it works for you.

from laravel-api-response-builder.

MarcinOrlowski avatar MarcinOrlowski commented on September 23, 2024

I just added Collection support but I am thinking about changing the way Model is handled too. For now, Model memebers goes directly into data node. I am thinking about putting it inside another object, i.e. item. so if you want to return single model, and it exposes just i.e. name then it would be returned as:

{
   "data": {
           "item": {
                  "name": "John"
            }
    }
}

this looks like better approach because you can easily add some other data to the response and do not care if you accidentally overwrite model (except for the item thing - I am going to make it configurable though). Comments?

from laravel-api-response-builder.

MarcinOrlowski avatar MarcinOrlowski commented on September 23, 2024

the change is now live in dev-master. There're also new config items - so check vendor/.../config for details. If nothing bad show up I will push it it out as 2.1 on Monday

from laravel-api-response-builder.

MarcinOrlowski avatar MarcinOrlowski commented on September 23, 2024

v2.1.0 is out now.

from laravel-api-response-builder.

Related Issues (20)

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.