<commit_before><?php

namespace Huntie\JsonApi\Support;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;

/**
 * Transform Eloquent models and collections into JSON API objects.
 */
trait JsonApiTransforms
{
    /**
     * Transform a model instance into a JSON API object.
     *
     * @param Model      $record
     * @param array|null $fields  Field subset to return
     * @param array|null $include Relations to include
     *
     * @return array
     */
    protected function transformRecord($record, array $fields = [], array $include = [])
    {
        $relations = array_unique(array_merge($record->getRelations(), $include));
        $record = $record->load($relations);

        $attributes = $record->toArray();<commit_msg>Fix unintended inclusion of relations in attributes object<commit_after><?php

namespace Huntie\JsonApi\Support;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;

/**
 * Transform Eloquent models and collections into JSON API objects.
 */
trait JsonApiTransforms
{
    /**
     * Transform a model instance into a JSON API object.
     *
     * @param Model      $record
     * @param array|null $fields  Field subset to return
     * @param array|null $include Relations to include
     *
     * @return array
     */
    protected function transformRecord($record, array $fields = [], array $include = [])
    {
        $relations = array_unique(array_merge($record->getRelations(), $include));
        $attributes = $record->toArray();
        $record = $record->load($relations);
{'fraction_non_alphanumeric': 0.11124401913875598, 'fraction_numerical': 0.0, 'mean_word_length': 3.391076115485564, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4605766', 'n_tokens_mistral': 459, 'n_tokens_neox': 461, 'n_words': 128}