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

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

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

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

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

原文地址:https://www.cnblogs.com/lxwphp/p/15453445.html