GithubHelp home page GithubHelp logo

Enum validation rule about laravel-enum HOT 8 CLOSED

spatie avatar spatie commented on May 29, 2024
Enum validation rule

from laravel-enum.

Comments (8)

Gummibeer avatar Gummibeer commented on May 29, 2024 1

Yeah, will check it out.

from laravel-enum.

Gummibeer avatar Gummibeer commented on May 29, 2024

It should extend the in:... rule. So instead of doing in:draft,archived,published it should be enum:StatusEnum::class.
This goes the normal way: StatusEnum::make() doing a try catch and return true/false. This wouldn't handle the legacy value map because this logic is present in the model not the enum. See my comments in #1 for the option that $map could be dropped so this couldn't be an issue.

In favor of the normal in:... rule this would allow to use the value, name or index without listing all possibilities.

from laravel-enum.

brendt avatar brendt commented on May 29, 2024

Great idea with extending the in: rule. Are you motivated to submit a PR for this? No pressure.

from laravel-enum.

spatie-bot avatar spatie-bot commented on May 29, 2024

Dear contributor,

because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.

from laravel-enum.

Gummibeer avatar Gummibeer commented on May 29, 2024

#13 isn't merged

from laravel-enum.

dennisoderwald avatar dennisoderwald commented on May 29, 2024

@Gummibeer Is there a time estimate when the feature will be released?

from laravel-enum.

Gummibeer avatar Gummibeer commented on May 29, 2024

@dennisoderwald were you able to test it? dev-ft-rules as composer version should do the trick.
If you could give feedback it would be awesome. Otherwise I will wait for feedback by @brendt .

from laravel-enum.

spatie-bot avatar spatie-bot commented on May 29, 2024

Dear contributor,

because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.

from laravel-enum.

Related Issues (20)

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.