20 lines
665 B
PHP
20 lines
665 B
PHP
<?php
|
|
|
|
use Illuminate\Support\Facades\Auth;
|
|
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 — operators only.
|
|
Broadcast::channel('admin.runs', fn () => (bool) Auth::guard('operator')->user()?->can('console.view'));
|
|
|
|
// 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();
|
|
});
|