define channel for accessing invoice presence

This commit is contained in:
Benjamin Beganović 2024-09-18 18:10:47 +02:00
parent a59e0388c0
commit e4a5821272

View File

@ -11,6 +11,8 @@
|
*/
use App\Models\User;
// Broadcast::channel('App.User.{id}', function ($user, $id) {
// nlog($id);
@ -18,6 +20,18 @@
// // return (int) $user->id === (int) $id;
// });
Broadcast::channel('company-{company_key}', function (\App\Models\User $user, string $company_key) {
Broadcast::channel('company-{company_key}', function (User $user, string $company_key) {
return $user->company()->company_key === $company_key;
});
});
Broadcast::channel('company-${company.company_key}.{roomId}', function (User $user, int $roomId) {
if ($user->canJoinRoom($roomId)) {
return ['id' => $user->id, 'name' => $user->name];
}
});
Broadcast::channel('company-{company_key}.invoices.{invoice_id}', function (User $user, string $company_key, string $invoice_id) {
// @todo
return true;
});