mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-17 02:54:06 -08:00
b34a7c8aad
Signed-off-by: snipe <snipe@snipe.net>
51 lines
985 B
PHP
51 lines
985 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Routing\Controller as BaseController;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
/**
|
|
* This controller provide the health route for
|
|
* the Snipe-IT Asset Management application.
|
|
*
|
|
* @version v1.0
|
|
*
|
|
* @return \Illuminate\Http\JsonResponse
|
|
|
|
*/
|
|
class HealthController extends BaseController
|
|
{
|
|
|
|
public function __construct()
|
|
{
|
|
$this->middleware('health');
|
|
}
|
|
|
|
|
|
/**
|
|
* Returns a fixed JSON content ({ "status": "ok"}) which indicate the app is up and running
|
|
*/
|
|
public function get()
|
|
{
|
|
try {
|
|
|
|
if (DB::select('select 2 + 2')) {
|
|
return response()->json([
|
|
'status' => 'ok',
|
|
]);
|
|
}
|
|
|
|
} catch (\Exception $e) {
|
|
\Log::error('Could not connect to database');
|
|
return response()->json([
|
|
'status' => 'database connection failed',
|
|
], 500);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|