Skip to content

Commit 6290b39

Browse files
committed
Merge branch 'release/2.1.1'
2 parents 53fc76b + 17710e7 commit 6290b39

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
All notable changes to this project will be documented in this file. This project adheres to
44
[Semantic Versioning](http://semver.org/) and [this changelog format](http://keepachangelog.com/).
55

6+
## [2.1.1] - 2022-04-01
7+
8+
### Fixed
9+
10+
- [#178](https://github.com/laravel-json-api/laravel/issues/178) Allow a resource id that is `"0"`.
11+
612
## [2.1.0] - 2022-02-20
713

814
### Added

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ See our website, [laraveljsonapi.io](https://laraveljsonapi.io)
9292
### Tutorial
9393

9494
New to JSON:API and/or Laravel JSON:API? Then
95-
the [Laravel JSON:API tutorial](https://laraveljsonapi.io/docs/1.0/tutorial/)
95+
the [Laravel JSON:API tutorial](https://laraveljsonapi.io/docs/2.0/tutorial/)
9696
is a great way to learn!
9797

9898
Follow the tutorial to build a blog application with a JSON:API compliant API.

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525
"require": {
2626
"php": "^7.4|^8.0",
2727
"ext-json": "*",
28-
"laravel-json-api/core": "^2.1",
28+
"laravel-json-api/core": "^2.2",
2929
"laravel-json-api/eloquent": "^2.1",
3030
"laravel-json-api/encoder-neomerx": "^2.0",
3131
"laravel-json-api/exceptions": "^1.1",
32-
"laravel-json-api/spec": "^1.1",
32+
"laravel-json-api/spec": "^1.1.1",
3333
"laravel-json-api/validation": "^2.0",
3434
"laravel/framework": "^8.76|^9.0"
3535
},

src/Routing/Route.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
use LaravelJsonApi\Contracts\Schema\Relation;
2828
use LaravelJsonApi\Contracts\Schema\Schema;
2929
use LaravelJsonApi\Contracts\Server\Server;
30+
use LaravelJsonApi\Core\Document\ResourceIdentifier;
3031
use LogicException;
3132
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
3233

@@ -99,11 +100,13 @@ public function modelOrResourceId()
99100
throw new LogicException('No JSON API resource id name set on route.');
100101
}
101102

102-
if ($modelOrResourceId = $this->route->parameter($name)) {
103-
return $modelOrResourceId;
103+
$modelOrResourceId = $this->route->parameter($name);
104+
105+
if (!is_object($modelOrResourceId) && ResourceIdentifier::idIsEmpty($modelOrResourceId)) {
106+
throw new LogicException('No JSON API resource id set on route.');
104107
}
105108

106-
throw new LogicException('No JSON API resource id set on route.');
109+
return $modelOrResourceId;
107110
}
108111

109112
/**

0 commit comments

Comments
 (0)