Skip to content

Commit

Permalink
Documentation Update for Laravel 11
Browse files Browse the repository at this point in the history
I found that the EventServiceProvider is no longer used in
Laravel 11. This commit introdues a section to inform Laravel 11
users of the alternative approach to registering the
LogoutDiscourseUser listener against the Logout event.
  • Loading branch information
JamieBradders committed Apr 11, 2024
1 parent afba03c commit 1aba8d9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,25 @@ When a Laravel `User` logs out, to log out their Discourse session Simply add th
];
```

### Laravel 11

In Laravel 11, the use of the `EventServiceProvider` is discouraged and events [should be registered in the `AppServiceProvider`](https://laravel.com/docs/11.x/events#manually-registering-events).

Therefore, the implementation is slightly different, and it should be registered within the `boot` method of the `AppServiceProvider` as per the example below.

```php
/**
* Bootstrap any application services.
*/
public function boot(): void
{
Event::listen(
\Illuminate\Auth\Events\Logout::class,
\Spinen\Discourse\Listeners\LogoutDiscourseUser::class
);
}
```

## Left to do

* badges for user
Expand Down

0 comments on commit 1aba8d9

Please sign in to comment.