fix bug
This commit is contained in:
1 parent
cdbad87958
commit
3a415edb6e
3 files changed
+27
-7
No files matched your search
@@ -18,9 +18,21 @@ class SupportChatController extends Controller
|
|||||||
{
|
{
|
||||||
public function index(): View
|
public function index(): View
|
||||||
{
|
{
|
||||||
|
if (app()->bound('debugbar')) {
|
||||||
|
app('debugbar')->disable();
|
||||||
|
}
|
||||||
|
|
||||||
|
$key = config('broadcasting.connections.reverb.key');
|
||||||
|
|
||||||
return view('nova.chat', [
|
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' => [
|
'pusher' => [
|
||||||
'key' => config('broadcasting.connections.reverb.key'),
|
'key' => $key,
|
||||||
'host' => config('broadcasting.connections.reverb.options.host'),
|
'host' => config('broadcasting.connections.reverb.options.host'),
|
||||||
'port' => (int) config('broadcasting.connections.reverb.options.port', 8080),
|
'port' => (int) config('broadcasting.connections.reverb.options.port', 8080),
|
||||||
'scheme' => config('broadcasting.connections.reverb.options.scheme', 'http'),
|
'scheme' => config('broadcasting.connections.reverb.options.scheme', 'http'),
|
||||||
@@ -89,4 +101,13 @@ private function assertSupportConversation(Conversation $conversation): User
|
|||||||
|
|
||||||
return $support;
|
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 @@
|
|||||||
'except' => [
|
'except' => [
|
||||||
'telescope*',
|
'telescope*',
|
||||||
'horizon*',
|
'horizon*',
|
||||||
|
'panel/chat*',
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||||
<meta name="robots" content="noindex">
|
<meta name="robots" content="noindex">
|
||||||
<title>{{ __('Chat') }} — {{ config('nova.name', config('app.name')) }}</title>
|
<title>{{ __('Chat') }} — {{ config('nova.name', config('app.name')) }}</title>
|
||||||
<link rel="stylesheet" href="{{ asset('assets/panel/css/chat.css') }}">
|
<style>{!! $chatCss !!}</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="mm-chat" id="mm-chat">
|
<div class="mm-chat" id="mm-chat">
|
||||||
@@ -54,10 +54,8 @@
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@if (! empty($pusher['key']))
|
@foreach ($chatScripts as $script)
|
||||||
<script src="{{ asset('assets/panel/js/pusher.min.js') }}"></script>
|
<script>{!! $script !!}</script>
|
||||||
<script src="{{ asset('assets/panel/js/echo.iife.js') }}"></script>
|
@endforeach
|
||||||
@endif
|
|
||||||
<script src="{{ asset('assets/panel/js/chat.js') }}"></script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Reference in new issue
Block a user