statamic / ideas

💡Discussions on ideas and feature requests for Statamic
https://statamic.dev
32 stars 1 forks source link

How to add a custom validation rule in backend? #928

Closed maxi032 closed 1 year ago

maxi032 commented 1 year ago

I need to check if a record is unique in it's collection but not only by id. I need to check the uniqueness in combination with the value from another field too. For that I made a custom rule with php artisan make:rule MyRule Basically I followed this example: https://benfurfie.co.uk/articles/adding-custom-validation-rules-to-statamic-3 but the rule is not visible in the dropdown.

I am using Statamic pro v3.3.59 and Laravel 9.42.2