Coder Social home page Coder Social logo

laravel-enum's People

Contributors

hailwood avatar ilyar avatar phordijk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

laravel-enum's Issues

Method getConstList should be static

  • PHP Version: 7.3.1
  • Laravel Version: 8.5
  • Laravel Enum Version: 2.2.0

Description:

Method getConstList should be static (available in class Enum)

Steps To Reproduce:

Create your UserEnumStatus class extending Enum
Call this function... UserEnumStatus::getConstList();

Hi bro

Are you going to support PHP 8 right now?

Bug: Enum::toArray(false) return with default null, if default not set

Have a enum:

/**
 * @method static BotKeywordType STRING()
 * @method static BotKeywordType EMAIL()
 * @method static BotKeywordType PHONE()
 */
final class KeywordType extends Enum
{
    //const __default = self::STRING;

    const STRING = 'string';
    const EMAIL = 'email';
    const PHONE = 'phone';
}

When use
var_dump(KeywordType::toArray(false));

result:

array (size=4)
  'STRING' => string 'string' (length=6)
  'EMAIL' => string 'email' (length=5)
  'PHONE' => string 'phone' (length=5)
  '__default' => null

But if i set default value - all ok, __default key not present...

Laravel 9

Hi, can you upgrade to Laravel 9? Thanks

EnumCastable::castAttribute fails when cast nullable field

class TestModel extends Model
{
    use EnumCastable;
    protected $casts = [
        'test_nullable_enum_field'     => TestEnum::class,
    ];
}

$model = TestModel::whereNull('test_nullable_enum_field')->first();
return $model->test_nullable_enum_field;

Expectation: null
Real: UnexpectedValueException : Value '' is not part of the enum TestEnum

Please fix this problem, and add support for nullable fields

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.