$posts->photos() is the relationship query to return all of the photos for a post. If you call delete() on that, it will delete…
You can use pluck
method,
$groups = Post::inCategory(1)->with('user','user.group')->get()->pluck('user.group')->all()
You can use pluck
method,
$groups = Post::inCategory(1)->with('user','user.group')->get()->pluck('user.group')->all()