Skip to content

Commit bcac4b6

Browse files
remove the step to manually register the event listener (#71)
1 parent 16f933e commit bcac4b6

File tree

1 file changed

+0
-52
lines changed

1 file changed

+0
-52
lines changed

resources/docs/notifications-and-events.md

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -232,58 +232,6 @@ We've used a [database cursor](https://laravel.com/docs/eloquent#cursors) to avo
232232
> **Note**
233233
> In a production application you should add the ability for your users to unsubscribe from notifications like these.
234234
235-
### Registering the event listener
236-
237-
Finally, let's bind our event listener to the event. This will tell Laravel to invoke our event listener when the corresponding event is dispatched. We can do this within our `EventServiceProvider` class:
238-
239-
```php filename=App\Providers\EventServiceProvider.php
240-
<?php
241-
242-
namespace App\Providers;
243-
244-
use App\Events\ChirpCreated;// [tl! add]
245-
use App\Listeners\SendChirpCreatedNotifications;// [tl! add]
246-
use Illuminate\Auth\Events\Registered;
247-
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
248-
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
249-
use Illuminate\Support\Facades\Event;
250-
251-
class EventServiceProvider extends ServiceProvider
252-
{
253-
/**
254-
* The event to listener mappings for the application.
255-
*
256-
* @var array<class-string, array<int, class-string>>
257-
*/
258-
protected $listen = [
259-
ChirpCreated::class => [// [tl! add:start]
260-
SendChirpCreatedNotifications::class,
261-
],// [tl! add:end]
262-
263-
Registered::class => [
264-
SendEmailVerificationNotification::class,
265-
],
266-
];
267-
// [tl! collapse:start]
268-
/**
269-
* Register any events for your application.
270-
*/
271-
public function boot(): void
272-
{
273-
//
274-
}
275-
276-
/**
277-
* Determine if events and listeners should be automatically discovered.
278-
*/
279-
public function shouldDiscoverEvents(): bool
280-
{
281-
return false;
282-
}
283-
// [tl! collapse:end]
284-
}
285-
```
286-
287235
## Testing it out
288236

289237
You may utilize local email testing tools like [Mailpit](https://github.com/axllent/mailpit) and [HELO](https://usehelo.com/) to catch any emails coming from your application so you may view them. If you are developing via Docker and Laravel Sail then Mailpit is included for you.

0 commit comments

Comments
 (0)