# Relation requests ID from database

**URL:** <https://talk.octobercms.com/t/relation-requests-id-from-database/1504>\
**Category:** Need Help\
**Created:** [June 26, 2023, 9:05pm UTC](https://talk.octobercms.com/t/relation-requests-id-from-database/1504 "2023-06-26T21:05:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![LordRazen](https://talk.octobercms.com/user_avatar/talk.octobercms.com/lordrazen/32/175_2.png) [@LordRazen](https://talk.octobercms.com/u/LordRazen)\
**Post date:** [June 26, 2023, 9:05pm UTC](https://talk.octobercms.com/t/relation-requests-id-from-database/1504/1 "2023-06-26T21:05:58Z")

</div>

I configured a relation like this:

**fields.yaml**

```auto
        contributors:
[...]
            type: relation
            useController: true

```

**config\_relation**

```auto
contributors:
    view:
        list: $/<namespace>/<plugin>models/<nameofmyrelation>/columns.yaml
        showCheckboxes: false

```

**columns.yaml**

```auto
columns:
    player_id:
        type: number
        clickable: false

    player:
        type: text
        relation: player
        select: playername
        clickable: false

```

**Relation within Submission Model**

```auto
    public $belongsToMany = [
        'players' => [
            Player::class,
            'table' => 'rel_submissions_players',
            'order' => 'playername',
            'timestamps' => true
        ]
]

```

When I try to edit one of the records in the backend, the following error message appears:  
`"SQLSTATE[42S22]: Column not found: 1054 Unknown column 'id' in 'field list' ...`

Since this is a simple relation I just have the player\_id and submission\_id in the table and created\_at as a date, but for some reason, also a basic id field is within the query.

Why? I thought it’s the checkbox, so I disabled them.  
I also thought it’s the link, so I disabled clickable.

Those records do not need to be opened. A display would be enough. But how can I solve this ID problem without creating an id column.

I’m also absolutly sure this worked a few weeks ago… not sure if something changed here in October 3.

Thanks for any help ^^

---

<div class="post-metadata">

**Author:** ![daftspunk](https://talk.octobercms.com/user_avatar/talk.octobercms.com/daftspunk/32/4_2.png) [@daftspunk](https://talk.octobercms.com/u/daftspunk)\
**Post date:** [June 27, 2023, 8:02am UTC](https://talk.octobercms.com/t/relation-requests-id-from-database/1504/2 "2023-06-27T08:02:37Z")

</div>

Hey @LordRazen

Can you share the `player` relation definition in the model?

---

<div class="post-metadata">

**Author:** ![LordRazen](https://talk.octobercms.com/user_avatar/talk.octobercms.com/lordrazen/32/175_2.png) [@LordRazen](https://talk.octobercms.com/u/LordRazen)\
**Post date:** [June 27, 2023, 9:06am UTC](https://talk.octobercms.com/t/relation-requests-id-from-database/1504/3 "2023-06-27T09:06:08Z")

</div>

**Relation within Submission Model**

```auto
    public $belongsToMany = [
        'players' => [
            Player::class,
            'table' => 'rel_submissions_players',
            'order' => 'playername',
            'timestamps' => true
        ]
]

```

(There’re also timestamps within this relation table. Didnt think this matters so far)

---

<div class="post-metadata">

**Author:** ![daftspunk](https://talk.octobercms.com/user_avatar/talk.octobercms.com/daftspunk/32/4_2.png) [@daftspunk](https://talk.octobercms.com/u/daftspunk)\
**Post date:** [June 27, 2023, 9:43am UTC](https://talk.octobercms.com/t/relation-requests-id-from-database/1504/4 "2023-06-27T09:43:47Z")

</div>

I’ve added an equivalent test to the test plugin and it seems to be working here:

> <https://github.com/octobercms/test-plugin/commit/949564de1f732272bbd771f1005ae2d9d339ec58>
