dingo / api

A RESTful API package for the Laravel and Lumen frameworks.
BSD 3-Clause "New" or "Revised" License
9.33k stars 1.25k forks source link

primitive not work #1568

Closed zhuman90 closed 5 years ago

zhuman90 commented 6 years ago
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

gazben commented 6 years ago

@laravuel Do you have the articlesCount relationship on the modell?

And please follow the issue template

specialtactics commented 6 years ago

Not really following what is going on here, there's no function "primitive" in this package at all?

specialtactics commented 5 years ago

Closing due to lack of template & response.

Please feel free to re-open with more info (and plz follow the issue template)