老师,有个问题Call to a member function toArray() on array
来源:10-8 下单接口业务模型 一
			慕慕0865687
2017-10-26
在本节14:00时有这么一段
位置:controller下的order类
private function getProductsByOrder($oproducts){
    $oPIDs=[];
    foreach ($oproducts as $item){
        array_push($oPIDs,$item['product_id']);
    }
    $products = ShopProduct::all($oPIDs)->visible(['id','price','stock','name','main_img_url'])->toArray();
    return $products;
}Call to a member function visible() on array
找到原因了:我databases里配置的是'resultset_type' => 'array',
写回答
	1回答
- 
				
						7七月
2017-10-27
好的,这个要是个collection类型
10 
相似问题