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
Requires
- php: ^8.1
- illuminate/contracts: ^9.0
- illuminate/database: ^9.0
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^6.0
- nunomaduro/larastan: ^2.0.1
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- spatie/laravel-ray: ^1.26
This package is auto-updated.
Last update: 2024-11-09 20:45:36 UTC
README
laravel-mysql-enum-values
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
- MIT, see LICENSE
Version
- Version 0.1
Contact
repat
- Homepage: https://repat.de
- e-mail: repat@repat.de
- Twitter: @repat123