M
M
Maxim2020-12-15 11:46:39
Laravel
Maxim, 2020-12-15 11:46:39

How to go back when registering?

Tell me how to return the user during registration, if the expression is not equal

if ($data['check'] != (int) Session::get('result_captcha')) {
          return redirect()->back()->withErrors('Проверьте правильность поля Антиспам!');
        }

protected function create(array $data)
    {
        if ($data['check'] != (int) Session::get('result_captcha')) {
          return redirect()->back()->withErrors('Проверьте правильность поля Антиспам!');
        }
        $user =  User::create([
            'name' => $data['name'],
            'surname' => $data['surname'],
            'email' => $data['email'],
            'birth' => $data['birth'],
            'phone' => $data['phone'],
            'street' => $data['street'],
            'house' => $data['house'],
            'path' => serialize($path),
            'city' => $data['city'],
            'rayon' => $data['rayon'] ?? '',
            'metro' => $data['metro'] ?? '',
            'password' => bcrypt(str_replace(' ', '', $data['password'])),
        ]);

        return $user;
    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey delphinpro, 2020-12-15
@delphinpro

Validators must be used. Lark itself will throw where it is necessary.
Threat
I love a mixture of English and transliteration =) If you don’t know a word, forget it in the translator. And you will write correctly, and you will learn a new word.
district => district
metro => subway

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question