Skip to content

Commit

Permalink
Merge branch 'release/2.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
lindyhopchris committed Apr 1, 2022
2 parents 53fc76b + 17710e7 commit 6290b39
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file. This project adheres to
[Semantic Versioning](http://semver.org/) and [this changelog format](http://keepachangelog.com/).

## [2.1.1] - 2022-04-01

### Fixed

- [#178](https://github.com/laravel-json-api/laravel/issues/178) Allow a resource id that is `"0"`.

## [2.1.0] - 2022-02-20

### Added
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ See our website, [laraveljsonapi.io](https://laraveljsonapi.io)
### Tutorial

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

Follow the tutorial to build a blog application with a JSON:API compliant API.
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
"require": {
"php": "^7.4|^8.0",
"ext-json": "*",
"laravel-json-api/core": "^2.1",
"laravel-json-api/core": "^2.2",
"laravel-json-api/eloquent": "^2.1",
"laravel-json-api/encoder-neomerx": "^2.0",
"laravel-json-api/exceptions": "^1.1",
"laravel-json-api/spec": "^1.1",
"laravel-json-api/spec": "^1.1.1",
"laravel-json-api/validation": "^2.0",
"laravel/framework": "^8.76|^9.0"
},
Expand Down
9 changes: 6 additions & 3 deletions src/Routing/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use LaravelJsonApi\Contracts\Schema\Relation;
use LaravelJsonApi\Contracts\Schema\Schema;
use LaravelJsonApi\Contracts\Server\Server;
use LaravelJsonApi\Core\Document\ResourceIdentifier;
use LogicException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

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

if ($modelOrResourceId = $this->route->parameter($name)) {
return $modelOrResourceId;
$modelOrResourceId = $this->route->parameter($name);

if (!is_object($modelOrResourceId) && ResourceIdentifier::idIsEmpty($modelOrResourceId)) {
throw new LogicException('No JSON API resource id set on route.');
}

throw new LogicException('No JSON API resource id set on route.');
return $modelOrResourceId;
}

/**
Expand Down

0 comments on commit 6290b39

Please sign in to comment.