Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

wim91's avatar

Is it possible to do conditional validation in Laravel?

Hello everyone. I have a form with fields for employee name and job title. When validating, if there's no employee name, there shouldn't be a job title. I understand that, in theory, I could create a condition for the received data to be empty, and also create client-side dependencies for whether fields are required. But is there a way to handle conditional validation using validate()? So, if the "Job Title" field is filled in, then check the "Employee Name" field for validation as well.

0 likes
1 reply

Please or to participate in this conversation.