octobroid / oc-api-plugin Goto Github PK
View Code? Open in Web Editor NEWBase API Plugin for OctoberCMS
License: MIT License
Base API Plugin for OctoberCMS
License: MIT License
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
];
}
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!
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()"
},
Hello, the plugin seems to be very fine.
How would it be possible to have authenticated (JWT) requests ? Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.