public function postsCount() { if ($this->postsCount === null) { $this->postsCount = $this->posts()->count(); } return $this->postsCount; }