BroadcastServiceProvider.php 550 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace App\Providers;
  3. use Illuminate\Support\ServiceProvider;
  4. use Illuminate\Support\Facades\Broadcast;
  5. class BroadcastServiceProvider extends ServiceProvider
  6. {
  7. /**
  8. * Bootstrap any application services.
  9. *
  10. * @return void
  11. */
  12. public function boot()
  13. {
  14. Broadcast::routes();
  15. /*
  16. * Authenticate the user's personal channel...
  17. */
  18. Broadcast::channel('App.User.{userId}', function ($user, $userId) {
  19. return (int) $user->id === (int) $userId;
  20. });
  21. }
  22. }