/
dimamir
/
coolify
Обзор
Документация
Войти
/
dimamir
/
coolify
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
app/Events/DatabaseStatusChanged.php
40 строк
922 B
Andras Bacsai
fix: use Auth(), add new db proxy stop event refactor clickhouse view
04 ноя 2024, 16:18
04 ноя 2024, 16:18
7fb1a1f
Код
Авторство
О чём код?
<?php namespace App\Events; use Illuminate\Broadcasting\InteractsWithSockets; use Illuminate\Broadcasting\PrivateChannel; use Illuminate\Contracts\Broadcasting\ShouldBroadcast; use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Queue\SerializesModels; use Illuminate\Support\Facades\Auth; class DatabaseStatusChanged implements ShouldBroadcast { use Dispatchable, InteractsWithSockets, SerializesModels; public $userId = null; public function __construct($userId = null) { if (is_null($userId)) { $userId = Auth::id() ?? null; } if (is_null($userId)) { return false; } $this->userId = $userId; } public function broadcastOn(): ?array { if (! is_null($this->userId)) { return [ new PrivateChannel("user.{$this->userId}"), ]; } return null; } }