将自定义元数据合并到laravel中的分页响应

I have the following Code in my Controller:

public function index(SaleRequest $request, $id) {

    try {
        $from = Carbon::parse($request->query->get('from', '1970-01-01'));
        $till = Carbon::parse($request->query->get('till', Carbon::now()))->endOfDay();
    } catch (\Exception $e) {
        return response()->json([
            'error' => 'Invalid time range or data',
        ], 400);
    }

    $includes = ['product', 'price'];

    $seller = $this->resellerRepository->findOrFail($id);

    $paginator = $this->parseRequest($request, $seller)->with($includes)->paginate();

    $sales = $paginator->items();

    $data = fractal()
        ->collection($sales, new SaleTransformer())
        ->parseIncludes($includes)
        ->paginateWith(new IlluminatePaginatorAdapter($paginator))
        ->toArray();

    $sum = 0;
    foreach ($sales as $sale) {
        $sum = $sum + $sale->price->value_origin;
    }

    $data['meta'] = [
        'from'          => $from->toDateString(),
        'till'          => $till->toDateString(),
        'count_total'   => count($data['data']),
        'total'         => $sum / 100,
    ];

    return response()->json($data);
}

In my response I dont get pagination meta data from paginator. I only get the custom meta data:

"meta": {
    "from": "1970-01-01",
    "till": "2018-09-05",
    "count_total": 5,
    "total": 80
}

My approach is to add pagination data manually to meta like:

    $data['meta'] = [
        'from'          => $from->toDateString(),
        'till'          => $till->toDateString(),
        'count_total'   => count($data['data']),
        'total_sum'         => $sum / 100,
        'pagination' => [
            'current_page' => $paginator->currentPage(),
            'last_page' => $paginator->lastPage(),
            'total' => $paginator->total(),
            'count' => $paginator->count(),
            'per_page' => $paginator->perPage(),
        ]
    ];

Is there a better approach to do this?

Thanks in advance!

the Answer was in updating my ide_helper methods as Fractal has a method addMeta() for this.

    $data = fractal()
        ->collection($items, new ItemTransformer())
        ->paginateWith(new IlluminatePaginatorAdapter($paginator))
        ->addMeta([
            'from' => $from->toDateString(),
            'till' => $till->toDateString(),
            'total_sum' => $totalSum,
            'page_sum' => $sum,
        ])
        ->toArray();