Skip to content

Question: Where is the fields parameter applied? #136

@peripteraptos

Description

@peripteraptos

Heyhey,
i have an eloquent accessor for one of my models, which does a lot of stuff.
it is like this in MyModel.php
public function getCustomAttribute(){ #do a lot of stuff }

when i request /api/v1/my-model, i dont want the custom attribute to be included. That's why i make the request like this, using the fields paramenter:
get /api/v1/my-model?fields[my-model]=name,status,text
it works somehow, but i figured out, that even if i don't include my time consuming custom attribute there, it seems to query it, because it takes the same amount of time.
On the other hand, it is much faster when i completly remove it from my $attributes but than i can't get it at the points where i need it.

Does anyone has an idea?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions