P
P
Pichenka942019-10-25 08:52:26
Laravel
Pichenka94, 2019-10-25 08:52:26

How to check a field with another table before registration in laravel?

Good afternoon!
Can you tell me how I can make a request for verification before registration?
It is necessary that when the registration button is pressed, one field is checked for data matching with the table (let's say verification_codes).
Those. a person fills in all the fields and clicks on the "register" button, before writing data to the users table, he goes to the verification_codes table and checks whether the correct code is entered in the corresponding field and if it is correct, then continues, if not, then we interrupt the registration.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
NubasLol, 2019-10-25
@Pichenka94

protected function validator(array $data)
    {
        return Validator::make($data, [
         'verification_code' => 'exists:verification_code_tables,verification_code_column'
        ]);
    }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question