2020-04-14 15:58:24 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
|
|
use App\Models\Projects;
|
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
|
|
|
|
|
class StatusCheckerController extends Controller
|
|
|
|
|
{
|
2022-06-13 15:49:59 +02:00
|
|
|
public function index(Request $request)
|
|
|
|
|
{
|
2020-04-17 09:18:42 +02:00
|
|
|
$wp_endpoint = 'https://api.wordpress.org/core/version-check/1.7/';
|
2022-06-13 15:49:59 +02:00
|
|
|
$client = new \GuzzleHttp\Client();
|
|
|
|
|
$response = $client->request('GET', $wp_endpoint);
|
|
|
|
|
$content = $response->getBody();
|
|
|
|
|
$oContent = json_decode($content);
|
2020-04-17 09:18:42 +02:00
|
|
|
|
|
|
|
|
$laravel_endpoint = 'https://github.com/laravel/laravel/releases/latest';
|
2022-06-13 15:49:59 +02:00
|
|
|
$client = new \GuzzleHttp\Client();
|
|
|
|
|
$response = $client->request('GET', $laravel_endpoint, [
|
2020-04-17 09:18:42 +02:00
|
|
|
'allow_redirects' => false
|
|
|
|
|
]);
|
2022-06-13 15:49:59 +02:00
|
|
|
$content = $response->getBody()->getContents();
|
|
|
|
|
$laravel_latest = substr($content, 84);
|
|
|
|
|
$laravel_latest = substr($laravel_latest, 0, -31);
|
2020-04-17 09:18:42 +02:00
|
|
|
|
|
|
|
|
$projects = Projects::orderBy('name')->get();
|
|
|
|
|
return view('status-checker.index', ['projects' => $projects, 'wp_latest' => $oContent->offers[0]->version, 'laravel_latest' => $laravel_latest]);
|
2020-04-14 15:58:24 +02:00
|
|
|
}
|
|
|
|
|
}
|