protected function resolveNestedRelations($data, $request)
    {
        foreach ($data as $key => $value) {
            if (is_array($value)) {
                $data[$key] = $this->resolveNestedRelations($value, $request);
            }
            elseif ($value instanceof static) {
                $data[$key] = $value->resolve($request);
            }
        }

        return $this->filter($data);
    }
protected function resolveNestedRelations($data, $request)
    {
        foreach ($data as $key => $value) {
            if (is_array($value)) {
                $data[$key] = $this->resolveNestedRelations($value, $request);
            }
            elseif ($value instanceof static) {
                $data[$key] = $value->resolve($request);
            }
        }

        return $this->filter($data);
    }
protected function resolveNestedRelations ( $ data , $ request ) { foreach ( $ data as $ key => $ value ) { if ( is_array ( $ value ) ) { $ data [ $ key ] = $ this -> resolveNestedRelations ( $ value , $ request ) ; } elseif ( $ value instanceof static ) { $ data [ $ key ] = $ value -> resolve ( $ request ) ; } } return $ this -> filter ( $ data ) ; }
Resolve the nested resources to an array.

@param  array                     $data
@param  \Illuminate\Http\Request  $request

@return array
Resolve the nested resources to an array .