We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 61be1d9 commit c326632Copy full SHA for c326632
README.md
@@ -592,11 +592,9 @@ class UserResource extends JsonApiResource
592
{
593
return [
594
'team' => fn () => TeamResource::make($this->team),
595
- 'posts' => fn () => $this->when(
596
- $request->user()->is($this->resource),
597
- fn () => PostResource::collection($this->posts),
598
- fn () => PostResource::collection($this->posts->where('published', true)),
599
- ),
+ 'posts' => fn () => $request->user()->is($this->resource)
+ ? PostResource::collection($this->posts)
+ : PostResource::collection($this->posts->where('published', true)),
600
];
601
}
602
0 commit comments