From 060ba3c7849aa409165f86d9418f27b96d7a9da3 Mon Sep 17 00:00:00 2001 From: Clemens John Date: Wed, 29 Jun 2016 23:18:39 +0200 Subject: [PATCH] When creating a new resource that has a client generated id we should take the id directly from the id property. The spec doesnt say anything about providing the id twice (in data and in atributes section). Fix #31 Signed-off-by: Clemens John --- src/NilPortugues/Laravel5/JsonApi/Controller/JsonApiTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NilPortugues/Laravel5/JsonApi/Controller/JsonApiTrait.php b/src/NilPortugues/Laravel5/JsonApi/Controller/JsonApiTrait.php index 3f1e0af..1986da4 100644 --- a/src/NilPortugues/Laravel5/JsonApi/Controller/JsonApiTrait.php +++ b/src/NilPortugues/Laravel5/JsonApi/Controller/JsonApiTrait.php @@ -211,7 +211,7 @@ protected function createResourceCallable() } if (!empty($data['id'])) { - $model->setAttribute($model->getKeyName(), $values['id']); + $model->setAttribute($model->getKeyName(), $data['id']); } try {