Improve ping command
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user