Skip to content

Commit

Permalink
chore: NowOn
Browse files Browse the repository at this point in the history
  • Loading branch information
lee-to committed Feb 8, 2025
1 parent bcb7c35 commit 22cd39c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Laravel/src/Pages/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,19 @@ protected function prepareBeforeRender(): void

public function simulateRoute(?PageContract $page = null, ?ResourceContract $resource = null): static
{
$targetPage = $page ?? $this;
$targetResource = $resource ?? $targetPage->getResource();

request()
->route()
?->setParameter('pageUri', ($page ?? $this)->getUriKey());
?->setParameter('pageUri', $targetPage->getUriKey());

if (! \is_null($resource)) {
$this->setResource($resource);
if (! \is_null($targetResource)) {
$this->setResource($targetResource);

request()
->route()
?->setParameter('resourceUri', $resource->getUriKey());
?->setParameter('resourceUri', $targetResource->getUriKey());
}

return $this;
Expand Down

0 comments on commit 22cd39c

Please sign in to comment.