Skip to content

Commit c3ec2f2

Browse files
committed
support route caching with trashed bindings
1 parent ac9b6e4 commit c3ec2f2

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

src/Illuminate/Routing/AbstractRouteCollection.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ public function compile()
146146
'bindingFields' => $route->bindingFields(),
147147
'lockSeconds' => $route->locksFor(),
148148
'waitSeconds' => $route->waitsFor(),
149+
'withTrashed' => $route->allowsTrashedBindings(),
149150
];
150151
}
151152

src/Illuminate/Routing/CompiledRouteCollection.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,8 @@ protected function newRoute(array $attributes)
302302
->setDefaults($attributes['defaults'])
303303
->setWheres($attributes['wheres'])
304304
->setBindingFields($attributes['bindingFields'])
305-
->block($attributes['lockSeconds'] ?? null, $attributes['waitSeconds'] ?? null);
305+
->block($attributes['lockSeconds'] ?? null, $attributes['waitSeconds'] ?? null)
306+
->withTrashed($attributes['withTrashed'] ?? false);
306307
}
307308

308309
/**

src/Illuminate/Routing/Route.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,11 +569,12 @@ public function parentOfParameter($parameter)
569569
/**
570570
* Allow "trashed" models to be retrieved when resolving implicit model bindings for this route.
571571
*
572+
* @param bool $withTrashed
572573
* @return $this
573574
*/
574-
public function withTrashed()
575+
public function withTrashed($withTrashed = true)
575576
{
576-
$this->withTrashedBindings = true;
577+
$this->withTrashedBindings = $withTrashed;
577578

578579
return $this;
579580
}

0 commit comments

Comments
 (0)