src/Eloquent/Concerns/QueriesRelations.php
protected function getRelation($record, $key)
    {
        $relation = $record->{$key}();

        if (!$relation || !$this->acceptRelation($relation)) {
            throw new RuntimeException(sprintf(
                'JSON API relation %s cannot be used for an Eloquent %s relation.',
                class_basename($this),
                class_basename($relation)
            ));
        }

        return $relation;
    }
protected function getRelation($record, $key)
    {
        $relation = $record->{$key}();

        if (!$relation || !$this->acceptRelation($relation)) {
            throw new RuntimeException(sprintf(
                'JSON API relation %s cannot be used for an Eloquent %s relation.',
                class_basename($this),
                class_basename($relation)
            ));
        }

        return $relation;
    }
Get the relation from the model.

@param Model $record
@param string $key
@return Relation|Builder