eskimo
eskimo

Reputation: 2624

Laravel Delete Event Listener

A while ago I added all events and listeners related to the auth system, as defined in the docs here, and generated all the listeners. I would now like to use only two listeners and clean up the Listeners folder.

So in EventServiceProvider I've commented out what I don't need:

protected $listen = [

    Registered::class => [
        SendEmailVerificationNotification::class,
    ],

    'Illuminate\Auth\Events\Registered' => [
        'App\Listeners\LogRegisteredUser',
    ],

    // 'Illuminate\Auth\Events\Attempting' => [
    //     'App\Listeners\LogAuthenticationAttempt',
    // ],

    // 'Illuminate\Auth\Events\Authenticated' => [
    //     'App\Listeners\LogAuthenticated',
    // ],

    'Illuminate\Auth\Events\Login' => [
        'App\Listeners\LogSuccessfulLogin',
    ],

    // 'Illuminate\Auth\Events\Failed' => [
    //     'App\Listeners\LogFailedLogin',
    // ],

    // 'Illuminate\Auth\Events\Logout' => [
    //     'App\Listeners\LogSuccessfulLogout',
    // ],

    // 'Illuminate\Auth\Events\Lockout' => [
    //     'App\Listeners\LogLockout',
    // ],

    // 'Illuminate\Auth\Events\PasswordReset' => [
    //     'App\Listeners\LogPasswordReset',
    // ],

    // 'Illuminate\Auth\Events\Verified' => [
    //     'App\Listeners\LogVerifiedUser',
    // ],
];

I then delete all Listeners in the app/Listeners folder.

If I then run php artisan event:generate I get an error:

ErrorException : include(/PATH HERE/vendor/composer/../../app/Listeners/LogRegisteredUser.php): failed to open stream: No such file or directory

What am I missing?

Upvotes: 1

Views: 3424

Answers (1)

5637800
5637800

Reputation: 677

I had the same problem. you may run command

php artisan clear-compiled

or,

composer dump-autoload

and then run php artisan event:generate

Upvotes: 2

Related Questions