ReCaptcha на Laravel - PullRequest
       8

ReCaptcha на Laravel

0 голосов
/ 18 июня 2020

У меня есть ReCaptcha в контроллере реестра, и я хотел поместить его в контроллер входа здесь, например,

<?php

namespace App\Http\Middleware;

use App\Rules\Captcha;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
use App\Rules\Captcha;

class Authenticate extends Middleware
{
    /**
     * Get the path the user should be redirected to when they are not authenticated.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return string|null
     */
    protected function redirectTo($request)
    {
        if (! $request->expectsJson()) {
            return route('login');
        }
    }

    protected function validateLogin(Request $request)
    {
        $this->validate($request, [
            'g-recaptcha-response' => new Captcha(),
        ]);
    }
}

Но я получаю сообщение об ошибке Cannot use App\Rules\Captcha as Captcha because the name is already in use Есть ли другие способы поместить ReCaptcha в регистр и лог?

1 Ответ

2 голосов
/ 18 июня 2020

У вас есть следующая строка дважды в начале вашего файла:

use App\Rules\Captcha;
...