Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
timacdonald committed Feb 6, 2023
1 parent 61be1d9 commit c326632
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -592,11 +592,9 @@ class UserResource extends JsonApiResource
{
return [
'team' => fn () => TeamResource::make($this->team),
'posts' => fn () => $this->when(
$request->user()->is($this->resource),
fn () => PostResource::collection($this->posts),
fn () => PostResource::collection($this->posts->where('published', true)),
),
'posts' => fn () => $request->user()->is($this->resource)
? PostResource::collection($this->posts)
: PostResource::collection($this->posts->where('published', true)),
];
}
}
Expand Down

0 comments on commit c326632

Please sign in to comment.