src/Database/Migration.php
/**
     * Add a prefix to index names on the given table blueprint.
     *
     * Laravel 5.5 doesn't automatically add the table prefix to index
     * names, but this has been fixed in 5.7. We will manually fix the
     * names for now, and we can remove this when we upgrade to 5.7.
     */
Add a prefix to index names on the given table blueprint.
Laravel 5.5 doesn't automatically add the table prefix to index
names, but this has been fixed in 5.7. We will manually fix the
names for now, and we can remove this when we upgrade to 5.7.
Add a prefix to index names on the given table blueprint . Laravel 5 . 5 doesn ' t automatically add the table prefix to index names but this has been fixed in 5 . 7 . We will manually fix the names for now and we can remove this when we upgrade to 5 . 7 .
public static function fixIndexNames(Builder $schema, Blueprint $table)
    {
        $indexCommands = [
            'unique', 'index', 'spatialIndex', 'foreign',
            'dropUnique', 'dropIndex', 'dropSpatialIndex', 'dropForeign'
        ];
        $prefix = $schema->getConnection()->getTablePrefix();
        foreach ($table->getCommands() as $command) {
            if (in_array($command->name, $indexCommands)) {
                $command->index = $prefix.$command->index;
            }
        }
    }
public static function fixIndexNames ( Builder $ schema , Blueprint $ table ) { $ indexCommands = [ 'unique' , 'index' , 'spatialIndex' , 'foreign' , 'dropUnique' , 'dropIndex' , 'dropSpatialIndex' , 'dropForeign' ] ; $ prefix = $ schema -> getConnection ( ) -> getTablePrefix ( ) ; foreach ( $ table -> getCommands ( ) as $ command ) { if ( in_array ( $ command -> name , $ indexCommands ) ) { $ command -> index = $ prefix . $ command -> index ; } } }
Add a prefix to index names on the given table blueprint.
Add a prefix to index names on the given table blueprint .