update
This commit is contained in:
parent
a586bf0ada
commit
3a7be52fa5
|
@ -43,6 +43,9 @@ class FarmController extends BaseApiController
|
||||||
$totalScale = $query->sum('form_scale');
|
$totalScale = $query->sum('form_scale');
|
||||||
// 基地列表
|
// 基地列表
|
||||||
$farmList = $query->select()->each(function ($farm){
|
$farmList = $query->select()->each(function ($farm){
|
||||||
|
// 档案数量
|
||||||
|
$fenceHouseIds = FenceHouse::where('farm_id', $farm['id'])->column('id');
|
||||||
|
$farm['animal_count'] = AnimalInfo::whereIn('fence_house_id', $fenceHouseIds)->count();
|
||||||
$fenceHouse = FenceHouse::where('farm_id', $farm['id'])->order('id desc')->findOrEmpty()->toArray();
|
$fenceHouse = FenceHouse::where('farm_id', $farm['id'])->order('id desc')->findOrEmpty()->toArray();
|
||||||
if(empty($fenceHouse)){
|
if(empty($fenceHouse)){
|
||||||
$farm['video_url'] = '';
|
$farm['video_url'] = '';
|
||||||
|
|
Loading…
Reference in New Issue