laravel - laravel 关系按数据分组
问题描述
如果不为空,如何通过 qrcode 和 sum price 选择此关系计数中的数据?
$wajibRetribusis =
WajibRetribusi::with(['subDistrict' => function ($q) use ($month, $year) {
$q->select('name', 'id');
}, 'payments' => function ($q) use ($month, $year) {
$q->whereMonth('payments.last_paid', $month);
$q->whereYear('payments.last_paid', $year);
$q->select('id', 'price', 'qr_code', 'category_id', 'last_paid');
}, 'category:id,price'])
->select('sub_district_id', 'qr_code', 'category_id')
->get();
解决方案
推荐阅读
- c++ - 如何将字符串消息添加到 RapidJson 文档分配器?
- javascript - 元素网格排列 CSS
- mysql - 文件上传角度 - spring boot - mysql
- tableau-api - 根据停留时间从总和中过滤单位
- socket.io - 将 Zope 与 socket-io 集成
- javascript - Video.js 中的自定义组件
- javascript - 使用 GitHub API 创建一个 gist
- android - 只要进度条可见就不要离开活动
- php - 自定义 Woocommerce 价格未从购物车传递到结帐
- r - 将坐标参考系设置为在 R 中创建的多边形