repat/laravel-mysql-enum-values

Small Laravel Query Builder Macro that returns valid values for a MySQL ENUM

0.1 2022-07-24 02:51 UTC

README

68747470733a2f2f6769746875622d6164732e73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f737570706f72742d756b7261696e652e7376673f743d31

laravel-mysql-enum-values

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

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'

Installation

You can install the package via composer:

composer require repat/laravel-mysql-enum-values

Usage

The package contains only one macro: enumValues. The Service Provider is automatically loaded.

DB::table('users')->enumValues('status'); // ['active', 'inactive']

License

Version

  • Version 0.1

Contact

repat

Flattr this git repo