Reusable Validation Rules with Laravel Form Requests
Currently I'm working on a project with a lot of forms that have repeated form fields. For example, pretty much all entities in the system can have attachments, so a lot of forms contain the same attachment fields. I could repeat the same validation rules in all form request classes, but this quickly breaks down. What if the rules for attachments change? Let's see how we can handle this more efficiently.