I want to NatSort Eloquent model output. I have attributes like Size 1/2
, Size 3/4
, Weight 1
, Weight 2
, Weight 10
...
In other words I want to natural sort strings but if there is fractions I want to sort them in ascending order too. (example: 3/8 is lower than 1/2)
CategoryAttribute::where('category_id', $catId)->with('attributes')->get();
I have position
column in table and want to sort them and save as sorted positions. How can I make it the most performance friendly?