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

Get all tags sorted by counter #25

Closed
crysfel opened this issue Mar 2, 2018 · 2 comments
Closed

Get all tags sorted by counter #25

crysfel opened this issue Mar 2, 2018 · 2 comments
Labels

Comments

@crysfel
Copy link

crysfel commented Mar 2, 2018

Hi there, thanks for maintaining this great package!

I'm wondering how can I get all tags sorted by count, I'm currently getting the tags like this:

$tags = Song::allTags()->get();

It works, but I'd like to sort the tags by the counter.

@brunogaspar
Copy link
Member

Hello @crysfel

You can use the orderBy() method from Eloquent.

Example:

Song::allTags()->orderBy('count', 'DESC')->get();

Hope it helps.

@crysfel
Copy link
Author

crysfel commented Mar 4, 2018

Thanks for the help! It worked!

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

No branches or pull requests

2 participants