Skip to content

Commit

Permalink
support route caching with trashed bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Aug 19, 2021
1 parent ac9b6e4 commit c3ec2f2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/Illuminate/Routing/AbstractRouteCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ public function compile()
'bindingFields' => $route->bindingFields(),
'lockSeconds' => $route->locksFor(),
'waitSeconds' => $route->waitsFor(),
'withTrashed' => $route->allowsTrashedBindings(),
];
}

Expand Down
3 changes: 2 additions & 1 deletion src/Illuminate/Routing/CompiledRouteCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,8 @@ protected function newRoute(array $attributes)
->setDefaults($attributes['defaults'])
->setWheres($attributes['wheres'])
->setBindingFields($attributes['bindingFields'])
->block($attributes['lockSeconds'] ?? null, $attributes['waitSeconds'] ?? null);
->block($attributes['lockSeconds'] ?? null, $attributes['waitSeconds'] ?? null)
->withTrashed($attributes['withTrashed'] ?? false);
}

/**
Expand Down
5 changes: 3 additions & 2 deletions src/Illuminate/Routing/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -569,11 +569,12 @@ public function parentOfParameter($parameter)
/**
* Allow "trashed" models to be retrieved when resolving implicit model bindings for this route.
*
* @param bool $withTrashed
* @return $this
*/
public function withTrashed()
public function withTrashed($withTrashed = true)
{
$this->withTrashedBindings = true;
$this->withTrashedBindings = $withTrashed;

return $this;
}
Expand Down

0 comments on commit c3ec2f2

Please sign in to comment.