ankane / hightop
A nice shortcut for group count queries with Eloquent / Laravel
v0.2.0
2024-07-01 00:45 UTC
Requires
- php: >= 8.1
- illuminate/database: >= 10
Requires (Dev)
- illuminate/database: >= 10
- illuminate/events: >= 10
- phpunit/phpunit: ^10
This package is not auto-updated.
Last update: 2024-11-18 02:28:59 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