7 Replies
What's the full generated SQL?
It looks like you don't have any relationships set up between the tables.
If you have the relationship set up, why not just specify the sort as
firstCategory.order_column
?
example: On a table for a resource for a Notes model that has a BelongsTo relationship named user
to the Users table, I can sort by user name when listing the notes in the table:
The relationship is currently set up.
You can't use
with()
and orderBy()
on the same data
With is an Eloquent construct that loads relationship in another query.
displayed in table builder
You probably want a
JOIN
clause
Sure. It fetches your category and then displays it. But that might be 2 queries.
Just because it's displayed in the table, that doesn't mean it's loaded with the same query