protected function extractRelations(array $relations): array
    {
        $available = $this->availableRelations();

        return array_filter($this->mapRelations($relations, function ($relation, $constraint) {
            $identifier = explode('.', $relation)[0];
            $constraint = $identifier === $relation ? $constraint : null;

            return [$identifier => $constraint ?: $this->resolveQueryConstraint($identifier)];
        }), function ($relation) use ($available) {
            return array_has($available, explode(':', $relation)[0]);
        }, ARRAY_FILTER_USE_KEY);
    }
protected function extractRelations(array $relations): array
    {
        $available = $this->availableRelations();

        return array_filter($this->mapRelations($relations, function ($relation, $constraint) {
            $identifier = explode('.', $relation)[0];
            $constraint = $identifier === $relation ? $constraint : null;

            return [$identifier => $constraint ?: $this->resolveQueryConstraint($identifier)];
        }), function ($relation) use ($available) {
            return array_has($available, explode(':', $relation)[0]);
        }, ARRAY_FILTER_USE_KEY);
    }
protected function extractRelations ( array $ relations ) : array { $ available = $ this -> availableRelations ( ) ; return array_filter ( $ this -> mapRelations ( $ relations , function ( $ relation , $ constraint ) { $ identifier = explode ( '.' , $ relation ) [ 0 ] ; $ constraint = $ identifier === $ relation ? $ constraint : null ; return [ $ identifier => $ constraint ? : $ this -> resolveQueryConstraint ( $ identifier ) ] ; } ) , function ( $ relation ) use ( $ available ) { return array_has ( $ available , explode ( ':' , $ relation ) [ 0 ] ) ; } , ARRAY_FILTER_USE_KEY ) ; }
Extract available root relations from the given list of relations.

@param  array $relations
@return array
Extract available root relations from the given list of relations .