Skip to content
Discussion options

You must be logged in to vote

The issue you're experiencing with the orderLogic for your spouse column is a common problem when using joins in Backpack. The problem isn't with your query logic itself, but rather with how Backpack handles the selection of columns when using custom ordering with joins.

When you use orderLogic with a join, you need to explicitly select the columns from your main table to avoid data being overwritten by the joined table. In your case, when you sort by spouse, the query works correctly, but Backpack isn't properly selecting just the columns from your main users table.

The solution is to add a select('users.*') to your orderLogic function:

'orderLogic' => function ($query, $column, $columnD…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by jcastroa87
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants