Skip to content

Commit

Permalink
fix a few inaccuracies
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Nov 13, 2015
2 parents 155ba9e + b3566a8 commit 176ab21
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 1 deletion.
32 changes: 32 additions & 0 deletions authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- [After Resetting Passwords](#after-resetting-passwords)
- [Social Authentication](#social-authentication)
- [Adding Custom Authentication Drivers](#adding-custom-authentication-drivers)
- [Events](#events)

<a name="introduction"></a>
## Introduction
Expand Down Expand Up @@ -680,3 +681,34 @@ Now that we have explored each of the methods on the `UserProvider`, let's take
}

This interface is simple. The `getAuthIdentifier` method should return the "primary key" of the user. In a MySQL back-end, again, this would be the auto-incrementing primary key. The `getAuthPassword` should return the user's hashed password. This interface allows the authentication system to work with any User class, regardless of what ORM or storage abstraction layer you are using. By default, Laravel includes a `User` class in the `app` directory which implements this interface, so you may consult this class for an implementation example.

<a name="events"></a>
## Events

Laravel raises a variety of [events](/docs/{{version}}/events) during the authentication process. You may attach listeners to these events in your `EventServiceProvider`:

/**
* Register any other events for your application.
*
* @param \Illuminate\Contracts\Events\Dispatcher $events
* @return void
*/
public function boot(DispatcherContract $events)
{
parent::boot($events);

// Fired on each authentication attempt...
$events->listen('auth.attempt', function ($credentials, $remember, $login) {
//
});

// Fired on successful logins...
$events->listen('auth.login', function ($user, $remember) {
//
});

// Fired on logouts...
$events->listen('auth.logout', function ($user) {
//
});
}
2 changes: 1 addition & 1 deletion cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ In contrast, this statement would remove only caches tagged with `authors`, so `
<a name="cache-events"></a>
## Cache Events

To execute code on every cache operation, you may listen for the events fired by the cache. Typically, you would place these event handlers within the `boot` method of your `EventServiceProvider`:
To execute code on every cache operation, you may listen for the [events](/docs/{{version}}/events) fired by the cache. Typically, you should place these event listeners within the `boot` method of your `EventServiceProvider`:

/**
* Register any other events for your application.
Expand Down
27 changes: 27 additions & 0 deletions events.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- [Broadcast Data](#broadcast-data)
- [Consuming Event Broadcasts](#consuming-event-broadcasts)
- [Event Subscribers](#event-subscribers)
- [Framework Events](#framework-events)

<a name="introduction"></a>
## Introduction
Expand Down Expand Up @@ -459,3 +460,29 @@ Once the subscriber has been defined, it may be registered with the event dispat
];
}

<a name="framework-events"></a>
## Framework Events

Laravel provides a variety of "core" events for actions performed by the framework. You can subscribe to them in the same way that you subscribe to your own custom events:

Event | Parameter(s)
------------- | -----------
artisan.start | $application
auth.attempt | $credentials, $remember, $login
auth.login | $user, $remember
auth.logout | $user
cache.missed | $key
cache.hit | $key, $value
cache.write | $key, $value, $minutes
cache.delete | $key
connection.{name}.beginTransaction | $connection
connection.{name}.committed | $connection
connection.{name}.rollingBack | $connection
illuminate.query | $query, $bindings, $time, $connectionName
illuminate.queue.after | $connection, $job, $data
illuminate.queue.failed | $connection, $job, $data
illuminate.queue.stopping | null
mailer.sending | $message
router.matched | $route, $request
composing:{view name} | $view
creating:{view name} | $view
22 changes: 22 additions & 0 deletions mail.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- [Inline Attachments](#inline-attachments)
- [Queueing Mail](#queueing-mail)
- [Mail & Local Development](#mail-and-local-development)
- [Events](#events)

<a name="introduction"></a>
## Introduction
Expand Down Expand Up @@ -230,3 +231,24 @@ Another solution provided by Laravel is to set a universal recipient of all e-ma
#### Mailtrap

Finally, you may use a service like [Mailtrap](https://mailtrap.io) and the `smtp` driver to send your e-mail messages to a "dummy" mailbox where you may view them in a true e-mail client. This approach has the benefit of allowing you to actually inspect the final e-mails in Mailtrap's message viewer.

<a name="events"></a>
## Events

Laravel fires the `mailer.sending` event just before sending mail messages. Remember, t this event is fired when the mail is *sent*, not when it is queued. You may register an event listener in your `EventServiceProvider`:

/**
* Register any other events for your application.
*
* @param \Illuminate\Contracts\Events\Dispatcher $events
* @return void
*/
public function boot(DispatcherContract $events)
{
parent::boot($events);

$events->listen('mailer.sending', function ($message) {
//
});
}

0 comments on commit 176ab21

Please sign in to comment.