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

geraldarcega's avatar

Validation unique with between date range

Is there a way to validate the uniqueness of a field BETWEEN date range in FormRequest? My validation rule looks like this:

['auditor' => 'required|unique:auditor_planned_leaves,auditor_id,null,auditor_id,leave_date_from,'.$this->get('auditor').'$this->get('leave_date_from')']

I can validate the leave_date_from, but I can't validate with the date range.

Or do I need to create a custom for it?

Thanks in advance for the solution and suggestions!

0 likes
2 replies
dneykov's avatar

Hi @geraldarcega,

I see this is pretty old post but did you came up with a solution? Currently I'm trying to do the same. Thanks

judev's avatar

Hello normally you can use between in your validation request but i don't know if that can do for date.

Please or to participate in this conversation.