ankane / hightop
为 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-09-23 01:53:58 UTC
README
为 Eloquent / Laravel 组计数查询的便捷方法
Visit::top('browser'); // [ // 'Chrome' => 63, // 'Safari' => 50, // 'Firefox' => 34 // ]
安装
运行
composer require ankane/hightop
选项
限制结果
Visit::top('referring_domain', 10);
包含空值
Visit::top('search_keyword', null: true);
支持表达式
use Illuminate\Database\Query\Expression; Visit::top(new Expression('lower(referring_domain)'));
并且是唯一的
Visit::top('city', distinct: 'user_id');
并且是最小计数
Visit::top('city', min: 10);
并且 where
条件
Visit::where('browser', 'Firefox')->top('os');
历史
查看 变更日志
贡献
鼓励每个人帮助改进此项目。以下是一些你可以帮助的方式
开始开发
git clone https://github.com/ankane/hightop-php.git cd hightop-php composer install composer test