z-song/laravel-admin · error · Exception
Column of this field must be a `BelongsToMany` or `HasMany`
Error message
Column of this field must be a `BelongsToMany` or `HasMany` relation.
What it means
Error "Column of this field must be a `BelongsToMany` or `HasMany` relation." thrown in z-song/laravel-admin.
Source
Thrown at src/Form/Field/MultipleSelect.php:47
return $this->otherKey;
}
if (is_callable([$this->form->model(), $this->column])) {
$relation = $this->form->model()->{$this->column}();
if ($relation instanceof BelongsToMany) {
/* @var BelongsToMany $relation */
$fullKey = $relation->getQualifiedRelatedPivotKeyName();
$fullKeyArray = explode('.', $fullKey);
return $this->otherKey = 'pivot.'.end($fullKeyArray);
} elseif ($relation instanceof HasManyRelation) {
/* @var HasManyRelation $relation */
return $this->otherKey = $relation->getRelated()->getKeyName();
}
}
throw new \Exception('Column of this field must be a `BelongsToMany` or `HasMany` relation.');
}
/**
* {@inheritdoc}
*/
public function fill($data)
{
if ($this->form && $this->form->shouldSnakeAttributes()) {
$key = Str::snake($this->column);
} else {
$key = $this->column;
}
$relations = Arr::get($data, $key);
if (is_string($relations)) {
$this->value = explode(',', $relations);
}View on GitHub (pinned to 67c441eb78)
When it happens
Trigger: Thrown at src/Form/Field/MultipleSelect.php:47 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of z-song/laravel-admin@67c441eb78 (2026-08-21).
Data as JSON: /api/errors/b02a66f26d67b20b.
Report an issue: GitHub.