mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-12 02:02:15 +01:00
Added timezone for user; Moved dashboard to controller
This commit is contained in:
35
app/Service/TimezoneService.php
Normal file
35
app/Service/TimezoneService.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Service;
|
||||
|
||||
use Carbon\CarbonTimeZone;
|
||||
use DateTimeZone;
|
||||
|
||||
class TimezoneService
|
||||
{
|
||||
/**
|
||||
* @return array<string>
|
||||
*/
|
||||
public function getTimezones(): array
|
||||
{
|
||||
$tzlist = CarbonTimeZone::listIdentifiers(DateTimeZone::ALL);
|
||||
|
||||
return $tzlist;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function getSelectOptions(): array
|
||||
{
|
||||
$tzlist = $this->getTimezones();
|
||||
$options = [];
|
||||
foreach ($tzlist as $tz) {
|
||||
$options[$tz] = $tz;
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user