kitloong / laravel-migrations-generator

Laravel Migrations Generator: Automatically generate your migrations from an existing database schema.
MIT License
2.43k stars 269 forks source link

set modifiers of all final enum constants to be public #183

Closed pepijnolivier closed 1 year ago

pepijnolivier commented 1 year ago

Hi thanks for bringing this package up to date 🙏

I wanted to filter some indexes using the Enum variable for IndexType (eg IndexType::primary) but noticed that these modifiers were all set to private, which means they are only accessible in their own namespace.

These are constant anyway, so I figured it would make sense to make all of these Enums public.

Having these public would make me allow to filter the primary keys on a table like such:

$primaryKeys = $table->getIndexes()->filter(function($index) {
    return $index->getType() == IndexType::PRIMARY;
});
pepijnolivier commented 1 year ago

Nevermind, read the docs in the Enum dependency and realized I should just use IndexType::PRIMARY() rather than IndexType::PRIMARY 👍