mirror of
https://github.com/alexjustesen/speedtest-tracker.git
synced 2026-06-23 07:20:09 +00:00
b29290913a
Co-authored-by: Shift <shift@laravelshift.com>
43 lines
935 B
PHP
43 lines
935 B
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Jobs\ExecSpeedtest;
|
|
use Illuminate\Console\Command;
|
|
|
|
class RunSpeedtest extends Command
|
|
{
|
|
/**
|
|
* The name and signature of the console command.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $signature = 'app:speedtest
|
|
{server? : Specify a server to run the test against}';
|
|
|
|
/**
|
|
* The console command description.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $description = 'Run a speedtest using Speedtest by Ookla';
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*/
|
|
public function handle(): int
|
|
{
|
|
$speedtest = [];
|
|
|
|
if ($this->argument('server')) {
|
|
$speedtest = array_merge($speedtest, ['ookla_server_id' => $this->argument('server')]);
|
|
}
|
|
|
|
ExecSpeedtest::dispatch(speedtest: $speedtest);
|
|
|
|
$this->info('✅ added manual speedtest to the queue');
|
|
|
|
return 0;
|
|
}
|
|
}
|