<commit_before><?php

declare(strict_types=1);

namespace Orchid\Platform\Traits;

use Orchid\Attachment\Models\Attachment;
use Illuminate\Database\Eloquent\Relations\MorphToMany;

/**
 * Trait Attachment.
 */
trait AttachTrait
{
    /**
     * @param string $group
     *
     * @return MorphToMany
     */
    public function attachment(string $group = null): MorphToMany
    {
        $query = $this->morphToMany(
            Attachment::class,
            'attachmentable',
            'attachmentable',
            'attachmentable_id',
            'attachment_id'
        );

        if (! is_null($group)) {
            $query->where('group', $group);
        }

        return $query
            ->orderBy('sort', 'asc');
    }
}
<commit_msg>ref #830 Fixed model change<commit_after><?php

declare(strict_types=1);

namespace Orchid\Platform\Traits;

use Orchid\Attachment\Models\Attachment;
use Illuminate\Database\Eloquent\Relations\MorphToMany;
use Orchid\Platform\Dashboard;

/**
 * Trait Attachment.
 */
trait AttachTrait
{
    /**
     * @param string $group
     *
     * @return MorphToMany
     */
    public function attachment(string $group = null): MorphToMany
    {
        $query = $this->morphToMany(
          Dashboard::model(Attachment::class),
            'attachmentable',
            'attachmentable',
            'attachmentable_id',
            'attachment_id'
        );

        if (! is_null($group)) {
            $query->where('group', $group);
        }

        return $query
            ->orderBy('sort', 'asc');
    }
}

{'fraction_non_alphanumeric': 0.13213598460551634, 'fraction_numerical': 0.003207184092366902, 'mean_word_length': 2.1901840490797544, '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': '1194508', 'n_tokens_mistral': 482, 'n_tokens_neox': 476, 'n_words': 82}