Skip to content

Commit 97af1ec

Browse files
fix single post visibility
1 parent 2db6fb1 commit 97af1ec

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

app/Http/Controllers/Api/PostController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ public function store(StorePostRequest $request): PostResource
5353

5454
public function show(Post $post): PostResource
5555
{
56-
if ($post->status !== PostStatus::PUBLISHED) {
56+
// Only published posts are visible to public, drafts visible to authors
57+
if ($post->status !== PostStatus::PUBLISHED && !auth()->user()?->isAdmin()) {
5758
throw new NotFoundHttpException('Post not found');
5859
}
5960

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy