c37373c083
- Updated method descriptions for fetching server time and date to improve clarity. - Added grouping and subgroup annotations for better organization in API documentation. - These changes collectively enhance the usability and clarity of the TimeDateController in the Truncgil Finance application.
61 lines
1.4 KiB
PHP
61 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\JsonResponse;
|
|
|
|
/**
|
|
* @OA\Info(title="Time and Date API", version="1.0.0")
|
|
*/
|
|
class TimeDateController extends Controller
|
|
{
|
|
/**
|
|
* Get current server time.
|
|
* @group Time
|
|
* @subgroup Server Info
|
|
*
|
|
* @OA\Get(
|
|
* path="/server-time",
|
|
* summary="Get Server Time",
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="Successful response",
|
|
* @OA\JsonContent(
|
|
* @OA\Property(property="server_time", type="string", example="14:30:00")
|
|
* )
|
|
* )
|
|
* )
|
|
*
|
|
* @return JsonResponse
|
|
*/
|
|
public function getServerTime(): JsonResponse
|
|
{
|
|
return response()->json(['server_time' => date('H:i:s')]);
|
|
}
|
|
|
|
/**
|
|
* Get current server date.
|
|
* @group Time
|
|
* @subgroup Server Info
|
|
*
|
|
* @OA\Get(
|
|
* path="/server-date",
|
|
* summary="Get Server Date",
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="Successful response",
|
|
* @OA\JsonContent(
|
|
* @OA\Property(property="server_date", type="string", example="2023-10-01")
|
|
* )
|
|
* )
|
|
* )
|
|
*
|
|
* @return JsonResponse
|
|
*/
|
|
public function getServerDate(): JsonResponse
|
|
{
|
|
return response()->json(['server_date' => date('Y-m-d')]);
|
|
}
|
|
}
|