So I have an Laravel app, but I have overridden the default sendEmailVerificationNotification
function in my App\User.php
. Because I didn't want the default email thing.
Now, when I register, I get an email and activation etc... That all works perfectly. However, when I click the link, I get a 500 error... So I go and look into the logs and see the follwoing error:
Class 'App\Http\Controllers\Auth\Verified' not found
Now, indeed, that class doesn't exist, because I have no idea what I should do in that class...
In my User.php
, the verify
method is the following;
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);
}
The full error is this:
[2019-04-14 11:57:29] staging.ERROR: Class 'App\Http\Controllers\Auth\Verified' not found {"userId":3,"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Class 'App\Http\Controllers\Auth\Verified' not found at /var/www/rpr/releases/20190414113903/app/Http/Controllers/Auth/VerificationController.php:60)
Line 60 in VerficationController.php
is the }
of the if-statement with hasVerifiedEmail
.
Can someone please explain how I can just verify the user and give a notification that the account has been verified?