Ignore Case When Using sortBy in Laravel

When using sortBy in Laravel, Laravel orders the results case-sensitive. If you want to ignore the case, so that the results are ordered case-insensitive, you can use this command:

$customers = Customer::all()->sortBy( 'name', SORT_NATURAL|SORT_FLAG_CASE );

sortBy accepts the same parameters as the php sort function. All possible parameters can be found here.