Getting the Event Dispatcher for Authentication

Problem

You want to access the event dispatcher used by authentication.

Solution

Use the Auth::getDispatcher() method.

$events = Auth::getDispatcher();

Discussion

Usually you can just access the Event facade.

By default Laravel uses the same event driver for both the Event facade and the Auth facade. This means unless your application is explicitly setting the event dispatcher, it's easier to use the Event facade.

comments powered by Disqus