我需要将我的自定义数据传递到相同级别的资源数组,但它会脱离数组
return CategoryProductsResource::collection(Category::whereNull('parent_id')->get())
->additional([
'data' => [
'id' => 9999,
'name' => 'How Offers',
'image' => 'http://businessdotkom.com/storage/categories/January2020/1o6nDi1kjVuwje5FiFXv.png',
'products' => ProductIndexResource::collection(Product::whereNotNull('sale_price')->get()),
]
]);
输出
不负相思意
人到中年有点甜