Closed
Description
Hi,
Thank you for this library.
My DB has two columns named part1_open_date
and part1_close_date
which are transmitted as:
public function getAttributes($resource)
{
return [
'part1' => [
'open_date' => $resource->part1_open_date,
'close_date' => $resource->part1_close_date
],
'created_at' => $resource->created_at->toAtomString(),
'updated_at' => $resource->updated_at->toAtomString(),
];
}
{
"data":
{
"type": "surveys",
"attributes": {
"part1": {
"open_date": "2019-08-31",
"close_date": "2019-12-01"
},
"created_at": "2020-08-26T13:18:20+00:00",
"updated_at": "2020-08-26T13:18:20+00:00"
}
}
}
A GET
request to the above endpoint works well (as seen).
However, I am having issues with a POST
. I am not sure how to correctly refer to the JSON nested object part1.open_date
and part1.close_date
within the corresponding App\JsonApi\Surveys\Adapter.php;
class.
There is a section on this in the docs but modifying the $attributes
variable is not working as expected.
protected $attributes = [
'part1' => [
'open_date' => 'part1_open_date',
'close_date' => 'part1_close_date'
]
];
I believe I am referencing the key in the wrong way.
Any help is appreciated.
Metadata
Metadata
Assignees
Labels
No labels