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;
    }