fix bug
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ return [
|
||||
'except' => [
|
||||
'telescope*',
|
||||
'horizon*',
|
||||
'panel/chat*',
|
||||
],
|
||||
|
||||
/*
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
<meta name="robots" content="noindex">
|
||||
<title>{{ __('Chat') }} — {{ config('nova.name', config('app.name')) }}</title>
|
||||
<link rel="stylesheet" href="{{ asset('assets/panel/css/chat.css') }}">
|
||||
<style>{!! $chatCss !!}</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="mm-chat" id="mm-chat">
|
||||
@@ -54,10 +54,8 @@
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@if (! empty($pusher['key']))
|
||||
<script src="{{ asset('assets/panel/js/pusher.min.js') }}"></script>
|
||||
<script src="{{ asset('assets/panel/js/echo.iife.js') }}"></script>
|
||||
@endif
|
||||
<script src="{{ asset('assets/panel/js/chat.js') }}"></script>
|
||||
@foreach ($chatScripts as $script)
|
||||
<script>{!! $script !!}</script>
|
||||
@endforeach
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user