This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

BOOMER74
BOOMER74

I try to relate user with item:
Fields:


manufacturer:
        label: Manufacturer
        type: relation
        emptyOption: Нет

Model:


public $belongsTo = [
    'manufacturer' => [
        "Backend\\Models\\User"
    ]
];

But get error:


Column not found: 1054 Unknown column 'name' in 'field list' (SQL: select `name`, `id` from `backend_users`)

What i need to do?

Last updated

Renatio
Renatio

Hi,

if you do not specify "nameFrom" parameter in relation field it will assume "name". There is no "name" field in backend_users table so you receive an error.

manufacturer:
    label: Manufacturer
    type: relation
    nameFrom: last_name
    emptyOption: Нет
BOOMER74
BOOMER74

Thanks, now work.

1-3 of 3

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.