sshateri
2 weeks ago
202
7
Laravel

Conditional Validation

Posted 2 weeks ago by sshateri

Hey everyone, im trying to validate a field before putting it in the DB and the validation should be something like this:

check the "username" to see if the same value exists inside the DB. if it's unique then pass the validation and insert it into DB. and if it existed then add a random number to the end of the value then check again until it becomes a unique value then insert it into the DB.

i check the Laravel documentation about conditional validation but could not find what i was looking for. any guide or help would be appreciated.

Please sign in or create an account to participate in this conversation.