laravel-websockets/src/Dashboard/Http/Controllers/ShowDashboard.php

32 lines
980 B
PHP
Raw Normal View History

2018-11-23 23:06:28 +00:00
<?php
2018-11-26 08:55:06 +00:00
namespace BeyondCode\LaravelWebSockets\Dashboard\Http\Controllers;
2018-11-23 23:06:28 +00:00
2020-09-10 19:59:26 +00:00
use BeyondCode\LaravelWebSockets\Contracts\AppManager;
use BeyondCode\LaravelWebSockets\DashboardLogger;
2020-03-04 09:58:39 +00:00
use Illuminate\Http\Request;
use React\EventLoop\LoopInterface;
2018-11-23 23:06:28 +00:00
2024-02-07 17:30:54 +00:00
use function Clue\React\Block\await;
2018-11-26 00:01:18 +00:00
class ShowDashboard
2018-11-23 23:06:28 +00:00
{
2020-08-18 17:21:22 +00:00
/**
* Show the dashboard.
*
* @param \Illuminate\Http\Request $request
2020-09-10 19:59:26 +00:00
* @param \BeyondCode\LaravelWebSockets\Contracts\AppManager $apps
2020-08-18 17:21:22 +00:00
* @return void
*/
2020-08-13 11:51:18 +00:00
public function __invoke(Request $request, AppManager $apps)
2018-11-23 23:06:28 +00:00
{
2018-11-26 00:01:18 +00:00
return view('websockets::dashboard', [
'apps' => await($apps->all(), app(LoopInterface::class), 2.0),
'port' => config('websockets.dashboard.port', 6001),
2020-08-18 06:35:09 +00:00
'channels' => DashboardLogger::$channels,
'logPrefix' => DashboardLogger::LOG_CHANNEL_PREFIX,
'refreshInterval' => config('websockets.statistics.interval_in_seconds'),
2018-11-24 22:52:55 +00:00
]);
2018-11-23 23:06:28 +00:00
}
2018-12-04 21:22:33 +00:00
}