diff --git a/app/Http/Controllers/ContactsController.php b/app/Http/Controllers/ContactsController.php index 4011c014b9c..d2bc8215a7d 100644 --- a/app/Http/Controllers/ContactsController.php +++ b/app/Http/Controllers/ContactsController.php @@ -133,6 +133,7 @@ private function contacts(Request $request, bool $active) ->withHasArchived($nbArchived > 0) ->withArchivedContacts($nbArchived) ->withTags($tags) + ->withSort($sort) ->withTagsCount($tagsCount) ->withUrl($url) ->withTagCount($count) diff --git a/app/Models/Contact/Contact.php b/app/Models/Contact/Contact.php index 48c6f9687d3..a1e1de7d11e 100644 --- a/app/Models/Contact/Contact.php +++ b/app/Models/Contact/Contact.php @@ -496,13 +496,13 @@ public function scopeSortedBy(Builder $builder, string $criteria): Builder { switch ($criteria) { case 'firstnameAZ': - return $builder->orderBy('first_name', 'asc'); + return $builder->orderBy('first_name'); case 'firstnameZA': - return $builder->orderBy('first_name', 'desc'); + return $builder->orderByDesc('first_name'); case 'lastnameAZ': - return $builder->orderBy('last_name', 'asc'); + return $builder->orderBy('last_name'); case 'lastnameZA': - return $builder->orderBy('last_name', 'desc'); + return $builder->orderByDesc('last_name'); case 'lastactivitydateNewtoOld': return $this->sortedByLastActivity($builder, 'desc'); case 'lastactivitydateOldtoNew': diff --git a/resources/views/people/index.blade.php b/resources/views/people/index.blade.php index 5eadb192eb2..5eb0e0d5073 100644 --- a/resources/views/people/index.blade.php +++ b/resources/views/people/index.blade.php @@ -76,27 +76,27 @@