使用withCount后再使用select设置查询的字段。就找不到withCount的数据了

https://laravelacademy.org/index.php/discussion/1021

 

如:Article::withCount(['comments'])->select('id')->get();

这样就没有 comments_count了。怎么弄出来呢?

答:select 和 withCount 对调个位置看看

posted @ 2019-04-17 10:00  码农编程进阶笔记  阅读(440)  评论(0编辑  收藏  举报
返回顶部 有事您Q我