Code Monkey home page Code Monkey logo

oc-api-plugin's People

Contributors

aneksa avatar erwinade avatar prasiman avatar serkanbektas avatar triasrahman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

oc-api-plugin's Issues

Double Relation Data

Hi there,

I like the implementation of this API idea for OC. I have an issue with a nested relation, it's showing up twice in a call. Once within the correct place, in this case items is a many relation of area but it's also appearing after the area object. See below.

Any idea what is wrong?

{
    "data": {
        "id": "1"
        "name": "Parent model"
     "areas": {
            "data": [
                {
                    "area": {
                        "id": "1",                      
                        "name": "an area",
                       "items": [
                            {
                                "id": "1",
                                "name": "an item",
                            }
                        ]
                    },
                    "items": {
                        "data": [
                            [
                                {
                                    "id": "1",
                                     "name": "an item",
                                }
                            ]
                        ]
                    }
               }
           ]
       }
   }
}

My Transformer classes call the relation includes like this.

    public $defaultIncludes = [
        'areas'
    ];

    public function data(Parent $parent)
    {
        return [
            'id'         => $parent->id,
        ];

    }

    public function includeAreas(Parent $parent)
    {
        return $this->collection($parent->areas, new AreasTransformer);
    }

public $defaultIncludes = [
        'items'
];

public function data(Areas $areas)
{
    return [
         $areas
    ];
}

public function includeItems(Areas $areas)
    {
        return $this->collection($areas->items, new ItemsTransformer);
    }
public $defaultIncludes = [];

public function data(Items $items)
{
    return [
         $items
    ];
}

Authentication ?

Hello, the plugin seems to be very fine.
How would it be possible to have authenticated (JWT) requests ? Thanks

Problem Extending Transformer

Got the following error returned from api when creating transformer following the given example:

"error": {
    "code": "INTERNAL_ERROR",
    "http_code": 500,
    "message": "Cannot override final method Octobro\\API\\Classes\\Transformer::transform()"
},

Artisan commands

I've just installed your plugin and was trying the artisan command to create a transformer.
"There are no commands defined in the "octobro" namespace" is what I am getting. The plugin was installed by the backend plugin manager so perhaps that's why no artisan commands are registered?

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.