Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

primitive not work #455

Closed
zhuman90 opened this issue Jun 26, 2018 · 1 comment
Closed

primitive not work #455

zhuman90 opened this issue Jun 26, 2018 · 1 comment

Comments

@zhuman90
Copy link

protected $availableIncludes = ['articles', 'articlesCount'];

    public function includeArticles(ArticleCategory $category) {
        return $this->collection($category->articles, new ArticleTransformer);
    }

    public function includeArticlesCount(ArticleCategory $category) {
        return $this->primitive($category->articles()->count());
    }

Call to undefined relationship [articlesCount] on model

i need help

@KorvinSzanto
Copy link
Contributor

This sounds like an Eloquent error. Make sure you are able to successfully able to get the count from your Articles model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants