我有一个雄辩的模型,我想在一次调用中返回多个查询的结果,我希望它在一个数组中:
public static function show_workplace($id) {
//calculate 3 queries with queryBuilder and return their results in an array
return [query1 , query2 ,query3]
}
我认为返回一组查询结果会以某种方式搞砸。例如当我回来时
return query1;
没关系 。但是当我回来
return [query1,query1]
它返回
[{"incrementing":true,"timestamps":true,"exists":true},{"incrementing":true,"timestamps":true,"exists":true}]
这些字段不是数据库的真实字段..!
有什么想法我做错了吗?在一个函数中返回多个查询仅仅是糟糕的设计,还是我只是错过了其他东西?