'likedPosts' => $this->when(Auth::check(), function () {
return $this->likedPosts;
}),
When the current user is logged in or when Auth::check() returns true, the resource response should appear.
But it's not working, I am not sure why. look at the following pictures


A simple solution would be doing it in
web.php, causeapi.phpdo nothing withauth.