CluPilotCloud/routes/channels.php

19 lines
592 B
PHP

<?php
use Illuminate\Support\Facades\Broadcast;
Broadcast::channel('App.Models.User.{id}', function ($user, $id) {
return (int) $user->id === (int) $id;
});
// Operator console live provisioning feed — admins only.
Broadcast::channel('admin.runs', fn ($user) => (bool) $user->is_admin);
// A customer's own provisioning feed — bridged from the auth user by email.
Broadcast::channel('customer.{customerId}.run', function ($user, $customerId) {
return \App\Models\Customer::query()
->whereKey($customerId)
->where('email', $user->email)
->exists();
});