protected function parseWith($params)
    {
        $with = explode(',', $params);
        $withable = $this->getSupportedParams('getApiWithable');

        $with = in_array('*', $withable) ? $with : array_only($with, $withable);

        foreach ($this->additionalSorts as $sort => $direction) {
            $parts = explode('.', $sort);
            $realKey = array_pop($parts);
            $relation = implode('.', $parts);

            if (in_array($relation, $with)) {
                $this->builder->with([$relation => function ($query) use ($realKey, $direction) {
                    $query->orderBy($realKey, $direction);
                }]);

                if (($key = array_search($relation, $with)) !== false) {
                    unset($with[$key]);
                }
            }
        }

        if (! empty($with)) {
            $this->builder->with($with);
        }

        $this->with = $this->builder->getEagerLoads();
    }