Laravel, for a while now, has included functionality for broadcasting server-side events over a WebSocket connection to the client-side. Often, as part of this process, it will prove necessary to authorize the current user. "Do they have permission to access this private channel or not?" Authorizations such as these are registered within your
If this file eventually becomes unwieldy, due to the number of authorizations, you may optionally extract the relevant logic to dedicated channel classes, using
php artisan make:channel.
Published on Mar 29th, 2018.