forked from alexjustesen/speedtest-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRunSpeedtest.php
More file actions
44 lines (35 loc) · 956 Bytes
/
RunSpeedtest.php
File metadata and controls
44 lines (35 loc) · 956 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?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.
*
* @return int
*/
public function handle()
{
$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;
}
}