ankane / hightop
A nice shortcut for group count queries with Eloquent / Laravel
v0.1.0
2022-08-23 02:30 UTC
Requires
- php: >= 8.0
- illuminate/database: >= 9.0
Requires (Dev)
- illuminate/database: >= 9.0
- illuminate/events: >= 9.0
- phpunit/phpunit: ^9
This package is not auto-updated.
Last update: 2024-05-01 08:40:40 UTC
README
A nice shortcut for group count queries with Eloquent / Laravel
Visit::top('browser'); // [ // 'Chrome' => 63, // 'Safari' => 50, // 'Firefox' => 34 // ]
Installation
Run:
composer require ankane/hightop
Options
Limit the results
Visit::top('referring_domain', 10);
Include null values
Visit::top('search_keyword', null: true);
Works with expressions
use Illuminate\Database\Query\Expression; Visit::top(new Expression('lower(referring_domain)'));
And distinct
Visit::top('city', distinct: 'user_id');
And min count
Visit::top('city', min: 10);
And where
clauses
Visit::where('browser', 'Firefox')->top('os');
History
View the changelog
Contributing
Everyone is encouraged to help improve this project. Here are a few ways you can help:
- Report bugs
- Fix bugs and submit pull requests
- Write, clarify, or fix documentation
- Suggest or add new features
To get started with development:
git clone https://github.com/ankane/hightop-php.git cd hightop-php composer install composer test