This commit is contained in:
Mekan1206
2026-08-15 19:45:56 +05:00
parent cdbad87958
commit 3a415edb6e
3 changed files with 27 additions and 7 deletions

View File

@@ -18,9 +18,21 @@ class SupportChatController extends Controller
{
public function index(): View
{
if (app()->bound('debugbar')) {
app('debugbar')->disable();
}
$key = config('broadcasting.connections.reverb.key');
return view('nova.chat', [
'chatCss' => $this->panelAsset('css/chat.css'),
'chatScripts' => array_values(array_filter([
$key ? $this->panelAsset('js/pusher.min.js') : null,
$key ? $this->panelAsset('js/echo.iife.js') : null,
$this->panelAsset('js/chat.js'),
])),
'pusher' => [
'key' => config('broadcasting.connections.reverb.key'),
'key' => $key,
'host' => config('broadcasting.connections.reverb.options.host'),
'port' => (int) config('broadcasting.connections.reverb.options.port', 8080),
'scheme' => config('broadcasting.connections.reverb.options.scheme', 'http'),
@@ -89,4 +101,13 @@ class SupportChatController extends Controller
return $support;
}
private function panelAsset(string $relative): string
{
$path = public_path('assets/panel/'.$relative);
abort_unless(is_readable($path), 500, "Missing chat asset [{$relative}].");
return (string) file_get_contents($path);
}
}