[英]Laravel 5.4 Class 'App\Http\Controllers\Admin\Auth\Auth' not found
[英]Laravel 5.8 Class 'App\Http\Controllers\Auth\Verified' not found
因此,我有一個Laravel應用程序,但是我的App\\User.php
覆蓋了默認的sendEmailVerificationNotification
函數。 因為我不想要默認的電子郵件。
現在,當我注冊時,我會收到一封電子郵件和激活信息……一切正常。 但是,當我單擊鏈接時,出現500錯誤...因此,我去查看日志並看到以下錯誤:
Class 'App\\Http\\Controllers\\Auth\\Verified' not found
現在,確實不存在該課程,因為我不知道在該課程中應該做什么...
在我的User.php
, verify
方法如下:
public function verify(Request $request): Response
{
if ($request->route('id') != $request->user()->getKey()) {
throw new AuthorizationException;
}
if ($request->user()->hasVerifiedEmail()) {
return redirect($this->redirectPath());
}
if ($request->user()->markEmailAsVerified()) {
event(new Verified($request->user()));
toastr()->success('Uw email is geverifiëerd', 'Gelukt!', ['timeOut' => 5000]);
}
return redirect($this->redirectPath())->with('verified', true);
}
完整的錯誤是這樣的:
[2019-04-14 11:57:29]登台。錯誤:找不到類'App \\ Http \\ Controllers \\ Auth \\ Verified'{“ userId”:3,“ exception”:“ [對象](Symfony \\ Component \\ Debug \\ Exception \\ FatalThrowableError(代碼:0):在/var/www/rpr/releases/20190414113903/app/Http/Controllers/Auth/VerificationController.php:60中找不到類'App \\ Http \\ Controllers \\ Auth \\ Verified' )
60號線在VerficationController.php
是}
用if語句hasVerifiedEmail
。
有人可以解釋一下我如何才能驗證用戶並通知帳戶已驗證嗎?
您必須使用Auth
門面。 將此行添加到您的控制器:
use Illuminate\Support\Facades\Auth;
您忘記添加已驗證的類供您使用,然后添加:
use Illuminate\Auth\Events\Verified;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.