channels.php 755 B

123456789101112131415161718192021222324
  1. <?php
  2. /*
  3. |--------------------------------------------------------------------------
  4. | Broadcast Channels
  5. |--------------------------------------------------------------------------
  6. |
  7. | Here you may register all of the event broadcasting channels that your
  8. | application supports. The given channel authorization callbacks are
  9. | used to check if an authenticated user can listen to the channel.
  10. |
  11. */
  12. Broadcast::channel('App.User.{id}', function ($user, $id) {
  13. return (int) $user->id === (int) $id;
  14. });
  15. Broadcast::channel('live.chat.{id}', function ($user, $id) {
  16. return true;
  17. }, ['guards' => ['web', 'api']]);
  18. Broadcast::channel('live.presence.{id}', function ($user, $id) {
  19. return [ $user->profile_id ];
  20. }, ['guards' => ['web', 'api']]);