<?php

use Illuminate\Support\Facades\Broadcast;

/*
|--------------------------------------------------------------------------
| Broadcast Channels
|--------------------------------------------------------------------------
|
| Here you may register all of the event broadcasting channels that your
| application supports. These channel authorization callbacks are used
| to check if an authenticated user can listen to the channel.
|
*/
Broadcast::routes();

// Default example
Broadcast::channel('App.Models.User.{id}', function ($user, $id) {
    return (int) $user->id === (int) $id;
});

// Custom example: Only admin users can listen to admin notifications
Broadcast::channel('admin.notifications', function ($user) {
    return $user && $user->role === 'admin';
});
