Intégration reservations et mock lavage
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use App\Http\Controllers\Concerns\RespondsWithJson;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Throwable;
|
||||
|
||||
class HealthController extends Controller
|
||||
{
|
||||
use RespondsWithJson;
|
||||
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
return $this->success([
|
||||
'status' => 'ok',
|
||||
'service' => 'laverie-api',
|
||||
'timestamp' => now()->toIso8601String(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function database(): JsonResponse
|
||||
{
|
||||
try {
|
||||
DB::select('SELECT 1');
|
||||
|
||||
return $this->success([
|
||||
'status' => 'ok',
|
||||
'database' => config('database.default'),
|
||||
'timestamp' => now()->toIso8601String(),
|
||||
]);
|
||||
} catch (Throwable $e) {
|
||||
return $this->error('Database connection failed', 503, [
|
||||
'database' => ['Connection unavailable'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user