with查询的数据,怎样合并到父表或子表中?

$stores = Store::where($where)
    ->with([
        'channel' => function ($query) {
            $query->select('id', 'channel_name'); 
        },
    ])
    ->select('store_group_id') 
    ->paginate($page_size)
    ->toArray();

这个查询中,with中的数据,会作为store中的一个字段,值为array的形式返回
怎样使这个数组合并到父表中的数据呢?

JellyBool

是什么意思?是不想 $store->channel->channel_name 这样么?直接 $store->channel_name?

Nixus 回复 JellyBool

这种单个模型没问题,列表的话,好像不适用