Palzin Track
Get 15% off with code PTRACKSIGNUP15 

Laravel Diary Logo

Laravel Collection Public API: sortByDesc

The sortByDesc method in Laravel operates the same as the sortBy method, but without the $descending parameter. Internally, sortByDesc calls sortBy with true as the $descending parameter. The following examples demonstrate how to use sortBy and sortByDesc to sort a collection by the name attribute.