$sorted = $collection->sortBy(function ($element, $key) {
$timestamp = strtotime($element->date_field);
return $timestamp;
});
Last active
December 3, 2020 14:20
-
-
Save remoblaser/60188d1e700964c8550008966d6610b1 to your computer and use it in GitHub Desktop.
Laravel Collection: Sort a String Datefield with a closure
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment