We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2db6fb1 commit 97af1ecCopy full SHA for 97af1ec
app/Http/Controllers/Api/PostController.php
@@ -53,7 +53,8 @@ public function store(StorePostRequest $request): PostResource
53
54
public function show(Post $post): PostResource
55
{
56
- if ($post->status !== PostStatus::PUBLISHED) {
+ // Only published posts are visible to public, drafts visible to authors
57
+ if ($post->status !== PostStatus::PUBLISHED && !auth()->user()?->isAdmin()) {
58
throw new NotFoundHttpException('Post not found');
59
}
60
0 commit comments