Skip to content

Commit

Permalink
call values() on the sorted array to reset the keys
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
y1n0 authored Jun 6, 2024
1 parent 9c66ec7 commit 25da590
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Taggable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

/**
Expand Down

0 comments on commit 25da590

Please sign in to comment.