laravel-websockets/src/Console/Commands/RestartServer.php

44 lines
877 B
PHP
Raw Normal View History

<?php
2020-09-10 19:59:26 +00:00
namespace BeyondCode\LaravelWebSockets\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\InteractsWithTime;
2020-09-10 19:59:26 +00:00
class RestartServer extends Command
{
use InteractsWithTime;
2020-08-18 17:21:22 +00:00
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'websockets:restart';
2020-08-18 17:21:22 +00:00
/**
* The console command description.
*
* @var string|null
*/
2020-09-10 19:59:26 +00:00
protected $description = 'Signal the WebSockets server to restart.';
2020-08-18 17:21:22 +00:00
/**
* Run the command.
*
* @return void
*/
public function handle()
{
2020-09-10 19:59:26 +00:00
Cache::forever(
'beyondcode:websockets:restart',
$this->currentTime()
);
2020-09-10 19:59:26 +00:00
$this->info(
'Broadcasted the restart signal to the WebSocket server!'
);
}
}