From 25da59097458592539de81bdd6503b941f01a4bb Mon Sep 17 00:00:00 2001 From: Abdelkoddous Date: Thu, 6 Jun 2024 14:27:30 +0200 Subject: [PATCH] call values() on the sorted array to reset the keys without calling `values`, the returned array format in not consistent: sometimes a numbered array if returned (if sort happened to not change the order) or an assoc array (in case sort did actually move items around and kept their index). --- src/Taggable.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Taggable.php b/src/Taggable.php index 48d13ba..7e265a8 100644 --- a/src/Taggable.php +++ b/src/Taggable.php @@ -466,7 +466,7 @@ public static function allTags(): array /** @var \Illuminate\Database\Eloquent\Collection $tags */ $tags = static::allTagModels(); - return $tags->pluck('name')->sort()->all(); + return $tags->pluck('name')->sort()->values()->all(); } /**