Skip to content

Counting relationships? #166

Closed
Closed
@fisharebest

Description

@fisharebest

Laravel provides support to add counts of relations to a model. e.g.

$posts = App\Post::withCount('comments')->get();

foreach ($posts as $post) {
    echo $post->comments_count;
}

Is there a way to incorporate $model->withCount(...) into a laravel-json-api request?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions