Added base app

Has basic login UI, has methods to run speedtests
This commit is contained in:
Henry Whitaker
2020-04-08 13:57:26 +01:00
parent e9fdc98fd3
commit 0062ac6960
114 changed files with 120193 additions and 1 deletions

View File

@@ -0,0 +1,49 @@
<?php
namespace App\Console\Commands;
use App\Helpers\SpeedtestHelper;
use Illuminate\Console\Command;
class SpeedtestCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'speedtest:run';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Performs a new speedtest';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$this->info('Running speedtest, this might take a while...');
$results = SpeedtestHelper::runSpeedtest();
$this->info('Ping: ' . $results->ping . ' ms');
$this->info('Download: ' . $results->download . ' Mbit/s');
$this->info('Upload: ' . $results->upload . ' Mbit/s');
}
}

View File

@@ -0,0 +1,61 @@
<?php
namespace App\Console\Commands;
use App\Helpers\SpeedtestHelper;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Artisan;
class SpeedtestLatestCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'speedtest:latest';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Returns the latest speedtest result';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$latest = SpeedtestHelper::latest();
if($latest) {
$this->info('Last speedtest run at: ' . $latest->created_at);
$this->info('Ping: ' . $latest->ping . ' ms');
$this->info('Download: ' . $latest->download . ' Mbit/s');
$this->info('Upload: ' . $latest->upload . ' Mbit/s');
} else {
$this->info('No speedtests have been run yet.');
$this->info('Running speedtest, this might take a while...');
$results = SpeedtestHelper::runSpeedtest();
$this->info('Ping: ' . $results->ping . ' ms');
$this->info('Download: ' . $results->download . ' Mbit/s');
$this->info('Upload: ' . $results->upload . ' Mbit/s');
}
}
}