Improve ping command

This commit is contained in:
Dennis
2020-11-28 11:12:54 +01:00
parent b0a76d311c
commit cb84438778

View File

@@ -3,6 +3,7 @@
namespace App\Jobs\Core;
use App\Services\Ploi\Ploi;
use App\Services\VersionChecker;
use Illuminate\Bus\Queueable;
use Illuminate\Support\Facades\Http;
use Illuminate\Queue\SerializesModels;
@@ -16,21 +17,27 @@ class Ping implements ShouldQueue
public function handle()
{
$version = new VersionChecker;
$response = Http::withHeaders([
'Accept' => 'application/json',
'Content-Type' => 'application/json',
'X-Ploi-Core-Key' => config('services.ploi.core-token')
])
->withToken(config('services.ploi.token'))
->get((new Ploi)->url . 'ping');
->post((new Ploi)->url . 'ping', [
'version' => $version->getApplicationVersion(),
'php_version' => phpversion(),
'panel_url' => config('app.url')
]);
if (!$response->ok() || !$response->json()) {
// Something went wrong..
return;
return 1;
}
$response->json();
return 0;
}
}