Skip to content

Commit 5870c4e

Browse files
committed
update README
1 parent 9619dde commit 5870c4e

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

README.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,27 @@ This package comes with a language file, that allows you to modify the error / c
7474
might see. In addition to that, you can change the notification class that will be used to send the confirmation code
7575
completely, by changing it in the `config/confirmation.php` file.
7676

77-
### Automatically logging users in, or adding custom logic, on confirmation
78-
On successful email confirmation, this package calls a `confirmed` function, which you can override in order to add any custom logic, such as sending a welcome email or automatically logging the user in.
77+
### The Confirmed Event
78+
On successful email confirmation, this package dispatches a `Confirmed` event, in order for you to conveniently handle
79+
any custom logic, such as sending a welcome email or automatically logging the user in.
80+
81+
Simply add the `Confirmed` event, and your listeners, to the `EventServiceProvider` in your application:
7982

80-
For example, if you want to automatically log the user in on confirmation, inside your `RegisterController` simply add:
8183
```php
82-
public function confirmed($user) {
83-
$this->guard()->login($user);
84-
}
84+
/**
85+
* The event listener mappings for the application.
86+
*
87+
* @var array
88+
*/
89+
protected $listen = [
90+
'BeyondCode\EmailConfirmation\Events\Confirmed' => [
91+
'App\Listeners\YourOnConfirmedListener'
92+
]
93+
];
8594
```
8695

96+
For more information about registering events and listeners, please refer to the [Laravel docs](https://laravel.com/docs/events#registering-events-and-listeners).
97+
8798
### Testing
8899

89100
``` bash

0 commit comments

Comments
 (0)