dimanche 9 juin 2019

How to avoid duplication in Laravel validation rules

For validating form validation rules I currently stored them in User Model and use it in Register Controller, User controller in admin panel, User Controller in APIs and some other places.

But currently it's very hard to maintain because each controller need a slightly different set of rules and when I change the rules in User Model other controllers will not work anymore.

So how to avoid duplication in rules and still keep the code maintainable?

Aucun commentaire:

Enregistrer un commentaire