Laravel Collection Public API: sortBy
Learn how to use the sortBy method in Laravel's Collection class to sort collection items based on a callback function or by a specific key. Sort the collection in either ascending or descending order. The sortBy method does not modify the original collection but returns a new sorted instance. Find code examples to sort a collection by name or by...