-1
I’m having trouble sorting data that are organized as follows:
1
1.1
2.2
2.2.1
2.2.1.1
10
11
The result I have is:
1
1.1
10
11
2.2
2.2.1
2.2.1.1
To order I’m using:
Schedule::where( 'construction_uuid', '=', $construction_uuid )->orderBy('eap', 'ASC')->get();
What would be the best solution to my problem?
It seems to me that its field is of type text and, therefore, the order obtained is the expected one. Maybe you want a numerical sort and in this case you should turn your text field into a number. Note the number of digits in each level. Another possibility is, while maintaining the text field, to normalize the size of the numbers of each level (, '01.00.00.00', '01.01.00.00', ... '10.01.12.05').
– anonimo