Lucas SenCab A Ugh Lucas SenCab A Ugh - 9 months ago 70
PHP Question

How to tie into Illuminate events Laravel 5.3

I want a message on my applications login page when the event of logout is trigged under


Since this is in core I thought it would be as simple as adding:

protected $listen = [
'App\Events\Logout' => [

as stated in

But after running artisan command it just creates a spot for me to make my own event. So my question is, can I listen to core events in Laravel like Logout without creating my own?

Answer Source

You should be able to listen for this event, however, the event isn't in your App namespace.

The namespace for the core Auth events is Illuminate\Auth\Events so you would have:

 protected $listen = [
    'Illuminate\Auth\Events\Logout' => [

Hope this helps!