mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-06-15 05:22:44 +01:00
34 lines
649 B
PHP
34 lines
649 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Controllers\Api\V1;
|
|
|
|
use App\Service\TimezoneService;
|
|
use Illuminate\Http\JsonResponse;
|
|
|
|
class TimeZoneController extends Controller
|
|
{
|
|
/**
|
|
* Get all timezones
|
|
*
|
|
* @response object{key: string}[]
|
|
*
|
|
* @operationId getTimezones
|
|
*/
|
|
public function index(): JsonResponse
|
|
{
|
|
$timezones = app(TimezoneService::class)->getTimezones();
|
|
|
|
$response = [];
|
|
|
|
foreach ($timezones as $timezone) {
|
|
$response[] = (object) [
|
|
'key' => $timezone,
|
|
];
|
|
}
|
|
|
|
return response()->json($response);
|
|
}
|
|
}
|