0
我在變AuthenticatesUsers.php使用google recaptcha在postLogin方法。Laravel不承認特質
有一個特點
<?php
namespace App\Traits;
use Illuminate\Support\Facades\Input;
use ReCaptcha\ReCaptcha;
trait CaptchaTrait {
public function captchaCheck()
{
...
}
}
和我AuthenticatesUsers.php
開始與
<?php
namespace Illuminate\Foundation\Auth;
use App\Traits\CaptchaTrait;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Lang;
trait AuthenticatesUsers
{
use RedirectsUsers;
use CaptchaTrait;
...
}
在登錄頁面,我得到這個錯誤
FatalErrorException in AuthenticatesUsers.php line 13: Trait
'App\Traits\CaptchaTrait' not found
不明白爲什麼。在PhpStorm進口類時CaptchaTrait自動導入應用程序\特徵\ CaptchaTrait到AuthenticatesUsers.php
我缺少什麼?
你的特質文件在哪裏? – jiboulex
app/App/Traits/CaptchaTrait.php – Caco
但是,修改'vendor'文件是個不好的習慣。 –