src/Handler.php
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();
    }
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();
    }
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 ( ) ; }
Parse the with parameter.

@param  string $params
@return void
Parse the with parameter .