Skip to content

Adding sorting by scope #549

@jersonmr

Description

@jersonmr

Hi there! I'd like to know if there is a way to get resources sorted by a scope? I know the package allow realize sorting by columns of the model but if I need realize sort by a related resource? Or by countable related resource?

Something like this:

public function scopeSortByLikes($query)
    {
        return $query->withCount('likes')
                ->orderBy('likes_count', $direction);
        });
    }

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions