/laravel-enum-group

Enumeration Groups built on top of BenSampo/laravel-enum

Primary LanguagePHPMIT LicenseMIT

@TODO :) Latest Version on Packagist GitHub Tests Action Status Total Downloads

Laravel Enum Group package is a simple collection wrapper around Ben Sampsons awesome laravel-enum -package. It's good to have a way to combine subsets of the enums to different kind of groups for additional checks etc and here Enum Group package helps

Installation

Current Pre Packagist Registration

Add composer.json:

    require: {
        ...
        "laravel-enum-group": "^1.0",
    }

    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/SPLCompanyOy/laravel-enum-group"
        }
    ],

TODO: Future Packagist Registration

You can install the package via composer:

composer require splcompanyoy/laravel-enum-group

Usage

use \EnumGroup;

$editableInvoiceStatuses = EnumGroup::get('invoice.editable');

$invoiceStatus = InvoiceStatus::SENT();

if ($editableInvoiceStatuses->has($invoiceStatus)) {
    $invoice::fill($input);
    $invoice->save();
}

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.