Answer the question
In order to leave comments, you need to log in
How to create custom validation rule in Laravel?
There is a ticket system for accepting smartphones for repair, written in Laravel. One of the fields in the ticket is the serial number of the device to be repaired. There is also a ticket status. There is a requirement - you cannot create a new ticket if the database already has a ticket with the same serial number and status "in processing". Those. Roughly speaking, when creating a new ticket, you need to check whether there is already an unclosed ticket with the same serial number in the database. I can't figure out how to do it.
If you had to stupidly check the serial number for uniqueness, then it's easy. But the fact that the serial does not have to be unique, provided that the ticket with the same serial has already been closed (has a certain status), adds to my difficulties.
Answer the question
In order to leave comments, you need to log in
You can create your own rule in any way described in the documentation .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question