【发布时间】:2021-04-28 03:17:35
【问题描述】:
错误:调用 int 上的成员函数 union()
$category = Category::select('name')->count();
$city = City::select('city')->count();
$client = Client::select('name')->count();
$property = Property::select('name')->count()
->union($category)
->union($city)
->union($client)
->get();
dd($property);
【问题讨论】:
-
错误说明了一切,你不能调用
count()->union($category) -
@ArSeN 我应该如何行动才能获得联合中的所有计数?
-
@ArSeN 先做所有的并集,把 count 放在最后
-
@codedge "错误:在 int 上调用成员函数 getBindings()"
$property=Property::select('name')->union($category)->union($city)->union($client)->count();
标签: php mysql laravel eloquent