Support: Laravel - Target class [App\Listeners\LogVerifiedUser] does not exist.

Created on 4 Aug 2020  Â·  6Comments  Â·  Source: EddieHubCommunity/support

Once an email address has been registered and the verification email is sent, I receive this error on the first click of 'verify email address'.

If I click the 'verify email address' button _again_, it works.

What might be causing that first error?

Thanks.

Screenshot 2020-08-04 at 16 59 43

Here's a snippet of the error and the code where LogVerifiedUser is used.

Screenshot 2020-08-04 at 17 28 47

question solved

Most helpful comment

In Laravel documentation App\Listeners\LogVerifiedUser is not a built in class, it's an example for a listener.
Try php artisan event:generate to generate the listener for you.

All 6 comments

From the error, it looks like the LogVerifiedUser class is not found. Does it exist?

In Laravel documentation App\Listeners\LogVerifiedUser is not a built in class, it's an example for a listener.
Try php artisan event:generate to generate the listener for you.

@alrifay thank you. In this case would I write php artisan event:generate LogVerifiedUser? Or just php artisan event:generate?

I've tried php artisan event:generate which seemed to fix the 'verify email address' link on the email. However it's hanging on the register screen once I click register.

@natelloyd1 are you trying to create LogVerifiedUser and do something when an account is "verified"? if so:

php artisan event:generate LogVerifiedUser will create that PHP file for you in App/Listeners/LogVerifiedUser.php with a class that you can then do things with.

@natelloyd1

  • [x] Completely half-read this issue
  • [x] Actually know what that event:generate does.
  • [x] Correct my mistakes ;)

What you want is a Listener as below.

githubrocks ➜ prototype git:(develop) php artisan make:listener MakeVerifiedUsersGreatAgain
Listener created successfully.
githubrocks ➜ prototype git:(develop) ✗ git status
On branch develop
Your branch is up to date with 'origin/develop'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        app/Listeners/MakeVerifiedUsersGreatAgain.php

nothing added to commit but untracked files present (use "git add" to track)
githubrocks ➜ prototype git:(develop) ✗ 

After a few tests that looks like it's fixed it.

I ran php artisan make:listener MakeVerifiedUsersGreatAgain.

To help others - perhaps I had the listener in my AppServiceProvider, but it was removed and I still had a cached version with the listener in.

So creating a new event listener fixed it.

Thank you @stemount & @alrifay

Was this page helpful?
0 / 5 - 0 ratings