lavina
7 months ago
1088
2
Laravel

backpack crud ordering on a pivot table

Posted 7 months ago by lavina

Hello guys,

i am using backpack and attempting to display a crud admin panel for a pivot table(does not have its own id). But i get the error:

message: "SQLSTATE[42S22]: Column not found: 1054 Unknown column 'id' in 'order clause' (SQL: select * from `section_user` order by 'id` desc limit 10)"

I attempted to add in setup:

$this->crud->orderBy('user_id');

but now its attempting to sort twice:

message: "SQLSTATE[42S22]: Column not found: 1054 Unknown column 'id' in 'order clause' (SQL: select * from `section_user` order by `user_id` asc, `id` desc limit 10)"

How can i override and remove the sort by id?

Please sign in or create an account to participate in this conversation.