Issue About Reorderable Table in Relation Manager
When i add reorderable to my table, it throws
Integrity constraint violation: 1052 Column 'order_column' in order clause is ambiguous
MySQL error . Because my pivot table and categories table has same order_column
column.
After i got this error i tried ->reorderable(DB::raw('groupables.order_column'))
and it's works for show but for update. This is not updates order_column
.
My Database Structure:
I have groups, groupables, products and categories tables. Groupables table is morphic table. Schema is like Group --[ morphedByMany ]-> Groupable --[ morphTo ]-> (Category | Product) .
| Group
- id
-name
| Groupable
- id
- group_id
- groupable_id
- groupable_type
- order_column
| Category
- id
- name
- order_column2 Replies
I don't think you need to use the DB facade. Just try
->reorderable('groupables.order_column')
.
Also, I think what you mean is that after you reorder the new order isn't being reflected. Is that right? Check your database and make sure your order column is being updated successfully. Assuming it is, try adding ->defaultSort('groupables.order_column')
. This will preserve the sort which you need since you aren't showing your order_column
column.Yeah now it's working. I don't know where i made mistake. But i remember i tried
->reorderable('groupables.order_column')
and it's not worked. Sorry for misunderstood.