public function transform($data)
    {
        $pagination = config('antares/api::pagination');
        $perPage    = request('per_page', array_get($pagination, 'per_page'));
        $pageName   = request('page_name', array_get($pagination, 'page_name'));
        $page       = request('page', 1);
        $query      = $data->getQuery();
        if ($query instanceof Builder) {
            return $query->paginate($perPage, ['*'], $pageName, $page);
        }
        $defered = $data->getDeferedData();
        if (is_null($query) and is_array($defered)) {
            return new LengthAwarePaginator($defered, count($defered), $perPage, $page);
        }
        if ($data instanceof DatatablesRawDataContract) {
            return $data->getRawData();
        }
        if ($data instanceof JsonResponse) {
            return $data->getData();
        }
    }
public function transform($data)
    {
        $pagination = config('antares/api::pagination');
        $perPage    = request('per_page', array_get($pagination, 'per_page'));
        $pageName   = request('page_name', array_get($pagination, 'page_name'));
        $page       = request('page', 1);
        $query      = $data->getQuery();
        if ($query instanceof Builder) {
            return $query->paginate($perPage, ['*'], $pageName, $page);
        }
        $defered = $data->getDeferedData();
        if (is_null($query) and is_array($defered)) {
            return new LengthAwarePaginator($defered, count($defered), $perPage, $page);
        }
        if ($data instanceof DatatablesRawDataContract) {
            return $data->getRawData();
        }
        if ($data instanceof JsonResponse) {
            return $data->getData();
        }
    }
public function transform ( $ data ) { $ pagination = config ( 'antares/api::pagination' ) ; $ perPage = request ( 'per_page' , array_get ( $ pagination , 'per_page' ) ) ; $ pageName = request ( 'page_name' , array_get ( $ pagination , 'page_name' ) ) ; $ page = request ( 'page' , 1 ) ; $ query = $ data -> getQuery ( ) ; if ( $ query instanceof Builder ) { return $ query -> paginate ( $ perPage , [ '*' ] , $ pageName , $ page ) ; } $ defered = $ data -> getDeferedData ( ) ; if ( is_null ( $ query ) and is_array ( $ defered ) ) { return new LengthAwarePaginator ( $ defered , count ( $ defered ) , $ perPage , $ page ) ; } if ( $ data instanceof DatatablesRawDataContract ) { return $ data -> getRawData ( ) ; } if ( $ data instanceof JsonResponse ) { return $ data -> getData ( ) ; } }
Transform Datatables data and return as array.

@param DatatablesRawDataContract | JsonResponse  $data
@return array
Transform Datatables data and return as array .