#5927·voyager

Position 0 at $index array is not certain to be existing

Author: Ciolo2002Created Nov 8, 2024Updated Nov 8, 2024
Labelspossible bug

Laravel version

11.30.0

PHP version

8.3.12

Voyager version

v1.8.0

Database

MySql 8.4

Description

The $index should not contain position 0 as it depens on mysql sorting while getting indexes.

Steps to reproduce

Create a table with more and 3 indexes and try to edit such BREAD, it will crash due to Undefined array key 0 at /var/www/vendor/tcg/voyager/src/Database/Schema/SchemaManager.php:76

Expected behavior

be certain to have $index[0] or a check to its existance

Screenshots

No response

Additional context

you should use array_values or check if !empty($indexes[0]['type']))