homeos/routes/channels.php

19 lines
699 B
PHP

<?php
use Illuminate\Support\Facades\Broadcast;
Broadcast::channel('App.Models.User.{id}', function ($user, $id) {
return (int) $user->id === (int) $id;
});
// Household-wide live updates — any authenticated user of this single-household system.
Broadcast::channel('home', fn ($user) => $user !== null);
// Per-device / per-room channels (used by detail views).
Broadcast::channel('devices.{uuid}', fn ($user, string $uuid) => $user !== null);
Broadcast::channel('rooms.{uuid}', fn ($user, string $uuid) => $user !== null);
// Presence + discovery live channels.
Broadcast::channel('presence', fn ($user) => $user !== null);
Broadcast::channel('discovery', fn ($user) => $user !== null);