Skip to content

Commit 74cd6e5

Browse files
authored
[Bugfix] Allow null as data for to-one relationship (#197)
This allows you to remove a to-one relationship by sending `null` in a PATCH request.
1 parent 45c60f4 commit 74cd6e5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: src/Http/Requests/ResourceRequest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ public function document(): array
204204
{
205205
$document = $this->json()->all();
206206

207-
if (!is_array($document) || !isset($document['data']) || !is_array($document['data'])) {
207+
if (!is_array($document) || !array_key_exists('data', $document) || !(is_array($document['data']) || is_null($document['data']))) {
208208
throw new LogicException('Expecting JSON API specification compliance to have been run.');
209209
}
210210

0 commit comments

Comments
 (0)