If you like the idea then search for Ardent and/or Magniloquent packages. They take this idea much further.
Creating a single instance of a class is never a big deal.
you could make the rules property and the validation method static, and just call it directly that way.
I use this version: https://tutsplus.com/lesson/validation-services/
You are gonna repeat the code for every model you want to validate with your version :)
I know it's nice to store rules in model ... but dont repeat code if you can find a better way :)
Sign in to participate in this thread!
We'd like to thank these amazing companies for supporting us