Stillat / meerkat-statamic3

Meerkat 2 is an extremely powerful and easy-to-use comment platform for Statamic 3.
https://meerkatcomments.com/
Other
5 stars 3 forks source link

Error when using custom validation rules in Meerkat blueprint #239

Open arkraieski opened 2 months ago

arkraieski commented 2 months ago

Hi, I'm not sure if this is a bug or unsupported functionality (or if it's possible I'm just doing something wrong), but as far as I can tell, custom Laravel validation does not work. I am on statamic 4.55.0 and meerkat 3.1.1

As a reproducible example, I followed the statamic and laravel docs in defining a custom Uppercase validation rule and referenced it in the meerkat blueprint yaml:

            handle: email
            field:
              type: text
              display: Email
              validate:
                - required
                - email
                - new App\Rules\Uppercase

Then, when I attempt to submit a comment, it throws an error: ERROR: Method Illuminate\Validation\Validator::validateNewApp\Rules\Uppercase does not exist.

I confirmed that the same validation rule class worked with other (non-meerkat related) blueprints in my control panel.

My real use case for custom validation rules is that I am trying to prevent guest commenters from using email addresses that look like those of site administrators.

JohnathonKoster commented 2 months ago

Hey there! I'll have to take a look to see if there is anything special I need to do on my end to also support this, as I haven't used the new validation rule style yet personally.

arkraieski commented 2 months ago

Thanks! And does that mean the old Rule interface would work for this for now? I'm actually coming from the opposite side (never having used the the old style rule personally).

JohnathonKoster commented 2 months ago

Doing some digging, it looks like I may have to add support for this explicitly. I'll let you know once that's available 👍

JohnathonKoster commented 4 weeks ago

An update on this one. I'm going to delay this change until Meerkat 4 since it ended up being quite a significant change to how the underlying form handler works.