最初是这样处理的

    1. $data = $query->order($order)->paginate($pagesize)->toArray();
    2. array_walk($data['data'], function (&$val){
    3. $val['add_pro'] = "haha";
    4. });
    5. return $data;

    后面发现官方有相关的支持

    1. $list = User::where($where)->order($order)->paginate()->each(function($item, $key){
    2. $item->nickname = 'think';
    3. })->toArray();

    两者各有各的适用范围,视情况使用吧

    注:each()其实不止用于分页

    1. User::where($where)->order($order)->select()->each(function($val){
    2. $val->nickname = 'think';
    3. })->toArray();