Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add logic check for if page is published if not 404 [WEB-2988] #642

Merged
merged 1 commit into from
Dec 19, 2024

Conversation

web-dev-trev
Copy link
Member

No description provided.

Copy link
Member

@nikhiltri nikhiltri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be cleaner to add a published() scope to the item retrieval, so we won't get anything back if it's not published. That would be on the line right before this change:

$item = $this->repository->published()->getById((int) $id);

@web-dev-trev web-dev-trev force-pushed the fix/press-releases-published-statuts branch from 7eb6952 to 4bef2f4 Compare December 19, 2024 18:24
@web-dev-trev web-dev-trev requested review from nikhiltri and removed request for zachgarwood December 19, 2024 18:24
@@ -149,7 +149,7 @@ protected function getNavElements($title)

public function show($id)
{
$item = $this->repository->getById((int) $id);
$item = $this->repository->published()->findOrFail((int) $id);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nikhiltri the getById method is a twill model method and not an eloquent one so I replaced it with the findOrFail which will 404 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Much better.

Copy link
Member

@nikhiltri nikhiltri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! ⭐

@web-dev-trev web-dev-trev merged commit 762a5e7 into develop Dec 19, 2024
4 checks passed
@web-dev-trev web-dev-trev deleted the fix/press-releases-published-statuts branch December 19, 2024 18:53
web-dev-trev added a commit that referenced this pull request Dec 19, 2024
…ses-published-statuts

Add logic check for if page is published if not 404 [WEB-2988]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants