Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken in Lumen #25

Closed
mrtoorich opened this issue Sep 4, 2018 · 8 comments
Closed

Broken in Lumen #25

mrtoorich opened this issue Sep 4, 2018 · 8 comments

Comments

@mrtoorich
Copy link

When using validation, errors came.

Call to undefined function BenSampo\Enum\Rules\resolve()
@BenSampo
Copy link
Owner

BenSampo commented Sep 4, 2018

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.

@mrtoorich
Copy link
Author

  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)],
    ]);
}

@BenSampo
Copy link
Owner

BenSampo commented Sep 4, 2018

Have you included a use statement for RpType?

By default it would be in App\Enums\RpType

@BenSampo
Copy link
Owner

BenSampo commented Sep 4, 2018

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.

@mrtoorich
Copy link
Author

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

@mrtoorich
Copy link
Author

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

@BenSampo
Copy link
Owner

BenSampo commented Sep 4, 2018

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

@mrtoorich
Copy link
Author

I will try. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants