Skip to content

Commit 9cd9630

Browse files
dneykovlindyhopchris
authored andcommitted
[Bugfix] Allow fetching resources with zero resource id (#463)
1 parent e6fdd52 commit 9cd9630

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/Routing/Route.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,19 +83,21 @@ public function __construct(ResolverInterface $resolver, ?IlluminateRoute $route
8383
public function substituteBindings(StoreInterface $store): void
8484
{
8585
/** Cache the ID values so that we still have access to them. */
86-
$this->resourceId = $this->getResourceId() ?: false;
87-
$this->processId = $this->getProcessId() ?: false;
88-
86+
$tempResourceId = $this->getResourceId();
87+
$tempProcessId = $this->getProcessId();
88+
$this->resourceId = isset($tempResourceId) ? $tempResourceId : false;
89+
$this->processId = isset($tempProcessId) ? $tempProcessId : false;
90+
8991
/** Bind the domain record. */
90-
if ($this->resourceId) {
92+
if (!empty($this->resourceId) || '0' === $this->resourceId) {
9193
$this->route->setParameter(
9294
ResourceRegistrar::PARAM_RESOURCE_ID,
9395
$store->findOrFail($this->getResourceType(), $this->resourceId)
9496
);
9597
}
96-
98+
9799
/** Bind the async process. */
98-
if ($this->processId) {
100+
if (!empty($this->processId) || '0' === $this->processId) {
99101
$this->route->setParameter(
100102
ResourceRegistrar::PARAM_PROCESS_ID,
101103
$store->findOrFail($this->getProcessType(), $this->processId)

0 commit comments

Comments
 (0)