Reordable pivot table in Relation Manager

I have 3 tables:
  • categories (id, name)
  • attributes (id, name)
  • attribute_category (category_id, attribute_id, order) - pivot table
I have AttributesRelationManager in Category Edit page:
class AttributesRelationManager extends RelationManager
{
...
protected static string $relationship = 'attributes';
...
public function table(Table $table): Table
{
  return $table->..
    ->columns([
        Tables\Columns\TextColumn::make('order'),
        Tables\Columns\TextColumn::make('name'),
    ])
    ->reorderable('order');
}
...
}


It shows category attributes nicely, ordered by order field in attribute_category

But then i try to reorder those displayed attributes, it generates DB error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'order' in 'field list'

update
  `attributes`
SET
  `ORDER` = CASE
...


What am i missing here?
Was this page helpful?