Files
speedtest-tracker/app/Console/Commands/TestInfluxDB.php
T
Alex Justesen ce21ae24db Laravel 11.x Shift (#1389)
Co-authored-by: Shift <shift@laravelshift.com>
2024-05-06 08:00:29 -04:00

43 lines
976 B
PHP

<?php
namespace App\Console\Commands;
use App\Models\Result;
use App\Settings\InfluxDbSettings;
use Illuminate\Console\Command;
class TestInfluxDB extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'app:test-influxdb';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Write a test log to InfluxDB to make sure the config works.';
/**
* Execute the console command.
*/
public function handle(InfluxDbSettings $settings): void
{
$influxdb = [
'enabled' => $settings->v2_enabled,
'url' => $settings?->v2_url,
'org' => $settings?->v2_org,
'bucket' => $settings?->v2_bucket,
'token' => $settings?->v2_token,
];
if ($influxdb['enabled'] == true) {
$result = Result::factory()->create();
}
}
}