Code Monkey home page Code Monkey logo

Comments (8)

BenSampo avatar BenSampo commented on May 20, 2024

Can you provide some context?

That error is usually caused because the enum class hasn't been imported or is using the wrong path. Make sure you're either importing it using the use statement or are using the fully qualified path name.

from laravel-enum.

mrtoorich avatar mrtoorich commented on May 20, 2024
  1. In the Controller
  2. BenSampo\Enum\EnumServiceProvider added
  3. use BenSampo\Enum\Rules\EnumValue added
  4. Validation code:
public function store(Request $request)
{
    $this->validate($request, [
        'type' => [new EnumValue(RpType::class)],
    ]);
}

from laravel-enum.

BenSampo avatar BenSampo commented on May 20, 2024

Have you included a use statement for RpType?

By default it would be in App\Enums\RpType

from laravel-enum.

BenSampo avatar BenSampo commented on May 20, 2024

Looking at the error message again, perhaps the resolve method doesn't exist in Lumen? It was introduced to Laravel in 5.3.

You could try changing line line 17 of BenSampo\Enum\Rules\EnumValue locally to use 'app' instead of 'resolve' to see if that helps.

https://github.com/BenSampo/laravel-enum/blob/master/src/Rules/EnumValue.php#L17

Let me know if it does.

from laravel-enum.

mrtoorich avatar mrtoorich commented on May 20, 2024

Works great if change resolve to app. 👍 But I cannot commit the changes in the vendor directory.

from laravel-enum.

mrtoorich avatar mrtoorich commented on May 20, 2024

My Lumen version is 5.6. Works great if changing resolve to app.

from laravel-enum.

BenSampo avatar BenSampo commented on May 20, 2024

I've pushed and tagged a new release which should fix this. Update to 1.11.1 and you should be good to go!

from laravel-enum.

mrtoorich avatar mrtoorich commented on May 20, 2024

I will try. Thanks!

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.