laravel-mysql-enum-values is a small Laravel Query Builder macro that returns the valid values of an ENUM field for MySQL. Under the hood it's using this statement:
SELECT * FROM information_schema.`COLUMNS` WHERE TABLE_NAME = 'table' AND COLUMN_NAME = 'column'
You can install the package via composer:
composer require repat/laravel-mysql-enum-values
The package contains only one macro: enumValues
. The Service Provider is automatically loaded.
DB::table('users')->enumValues('status'); // ['active', 'inactive']
- MIT, see LICENSE
- Version 0.1
- Homepage: https://repat.de
- e-mail: repat@repat.de
- Twitter: @repat123