Multiple sortBy()
Closed this issue · 3 comments
Hello,
I would like to know if it would be possible to use multiple sortBy() as we usually use with SQL queries.
Example:
I have 1 menu that has 1 order in its main items, each item has a submenu. In this case I would like to have a numerical order of the main items and alphabetical order in the submenus.
How could I do this?
P.S.: I saw that I can write my own sorting rule, it could be faster just do for example:
->sortBy('order', 'asc')->sortBy('title', 'asc');
doing some tests did the inversion and it seems to work, I will close this issue.
->sortBy('title', 'asc')->sortBy('order', 'asc');
doing some tests did the inversion and it seems to work, I will close this issue.
->sortBy('title', 'asc')->sortBy('order', 'asc');
With more menu options and accentuation, this didn't work correctly. sortBy('order', 'asc')
takes precedence over the first option. Sub-items are not ordered correctly by sortBy('title', 'asc')
Any help on this issue?
The function is pretty simple, you can take a look:
laravel-menu/src/Lavary/Menu/Builder.php
Line 467 in 14eed36