diff --git a/.phpstorm.meta.php b/.phpstorm.meta.php index 9724246ae..4cc32fb9e 100644 --- a/.phpstorm.meta.php +++ b/.phpstorm.meta.php @@ -189,7 +189,6 @@ 'Spatie\LaravelSettings\SettingsMapper' => \Spatie\LaravelSettings\SettingsMapper::class, 'Spatie\LaravelSettings\SettingsRepositories\SettingsRepository' => \Spatie\LaravelSettings\SettingsRepositories\DatabaseSettingsRepository::class, 'Spatie\LaravelSettings\Support\SettingsCacheFactory' => \Spatie\LaravelSettings\Support\SettingsCacheFactory::class, - 'Squire\RepositoryManager' => \Squire\RepositoryManager::class, 'Symfony\Component\HtmlSanitizer\HtmlSanitizerInterface' => \Symfony\Component\HtmlSanitizer\HtmlSanitizer::class, 'auth' => \Illuminate\Auth\AuthManager::class, 'auth.driver' => \Illuminate\Auth\SessionGuard::class, @@ -427,7 +426,6 @@ 'Spatie\LaravelSettings\SettingsMapper' => \Spatie\LaravelSettings\SettingsMapper::class, 'Spatie\LaravelSettings\SettingsRepositories\SettingsRepository' => \Spatie\LaravelSettings\SettingsRepositories\DatabaseSettingsRepository::class, 'Spatie\LaravelSettings\Support\SettingsCacheFactory' => \Spatie\LaravelSettings\Support\SettingsCacheFactory::class, - 'Squire\RepositoryManager' => \Squire\RepositoryManager::class, 'Symfony\Component\HtmlSanitizer\HtmlSanitizerInterface' => \Symfony\Component\HtmlSanitizer\HtmlSanitizer::class, 'auth' => \Illuminate\Auth\AuthManager::class, 'auth.driver' => \Illuminate\Auth\SessionGuard::class, @@ -665,7 +663,6 @@ 'Spatie\LaravelSettings\SettingsMapper' => \Spatie\LaravelSettings\SettingsMapper::class, 'Spatie\LaravelSettings\SettingsRepositories\SettingsRepository' => \Spatie\LaravelSettings\SettingsRepositories\DatabaseSettingsRepository::class, 'Spatie\LaravelSettings\Support\SettingsCacheFactory' => \Spatie\LaravelSettings\Support\SettingsCacheFactory::class, - 'Squire\RepositoryManager' => \Squire\RepositoryManager::class, 'Symfony\Component\HtmlSanitizer\HtmlSanitizerInterface' => \Symfony\Component\HtmlSanitizer\HtmlSanitizer::class, 'auth' => \Illuminate\Auth\AuthManager::class, 'auth.driver' => \Illuminate\Auth\SessionGuard::class, @@ -903,7 +900,6 @@ 'Spatie\LaravelSettings\SettingsMapper' => \Spatie\LaravelSettings\SettingsMapper::class, 'Spatie\LaravelSettings\SettingsRepositories\SettingsRepository' => \Spatie\LaravelSettings\SettingsRepositories\DatabaseSettingsRepository::class, 'Spatie\LaravelSettings\Support\SettingsCacheFactory' => \Spatie\LaravelSettings\Support\SettingsCacheFactory::class, - 'Squire\RepositoryManager' => \Squire\RepositoryManager::class, 'Symfony\Component\HtmlSanitizer\HtmlSanitizerInterface' => \Symfony\Component\HtmlSanitizer\HtmlSanitizer::class, 'auth' => \Illuminate\Auth\AuthManager::class, 'auth.driver' => \Illuminate\Auth\SessionGuard::class, @@ -1141,7 +1137,6 @@ 'Spatie\LaravelSettings\SettingsMapper' => \Spatie\LaravelSettings\SettingsMapper::class, 'Spatie\LaravelSettings\SettingsRepositories\SettingsRepository' => \Spatie\LaravelSettings\SettingsRepositories\DatabaseSettingsRepository::class, 'Spatie\LaravelSettings\Support\SettingsCacheFactory' => \Spatie\LaravelSettings\Support\SettingsCacheFactory::class, - 'Squire\RepositoryManager' => \Squire\RepositoryManager::class, 'Symfony\Component\HtmlSanitizer\HtmlSanitizerInterface' => \Symfony\Component\HtmlSanitizer\HtmlSanitizer::class, 'auth' => \Illuminate\Auth\AuthManager::class, 'auth.driver' => \Illuminate\Auth\SessionGuard::class, @@ -1379,7 +1374,6 @@ 'Spatie\LaravelSettings\SettingsMapper' => \Spatie\LaravelSettings\SettingsMapper::class, 'Spatie\LaravelSettings\SettingsRepositories\SettingsRepository' => \Spatie\LaravelSettings\SettingsRepositories\DatabaseSettingsRepository::class, 'Spatie\LaravelSettings\Support\SettingsCacheFactory' => \Spatie\LaravelSettings\Support\SettingsCacheFactory::class, - 'Squire\RepositoryManager' => \Squire\RepositoryManager::class, 'Symfony\Component\HtmlSanitizer\HtmlSanitizerInterface' => \Symfony\Component\HtmlSanitizer\HtmlSanitizer::class, 'auth' => \Illuminate\Auth\AuthManager::class, 'auth.driver' => \Illuminate\Auth\SessionGuard::class, @@ -1617,7 +1611,6 @@ 'Spatie\LaravelSettings\SettingsMapper' => \Spatie\LaravelSettings\SettingsMapper::class, 'Spatie\LaravelSettings\SettingsRepositories\SettingsRepository' => \Spatie\LaravelSettings\SettingsRepositories\DatabaseSettingsRepository::class, 'Spatie\LaravelSettings\Support\SettingsCacheFactory' => \Spatie\LaravelSettings\Support\SettingsCacheFactory::class, - 'Squire\RepositoryManager' => \Squire\RepositoryManager::class, 'Symfony\Component\HtmlSanitizer\HtmlSanitizerInterface' => \Symfony\Component\HtmlSanitizer\HtmlSanitizer::class, 'auth' => \Illuminate\Auth\AuthManager::class, 'auth.driver' => \Illuminate\Auth\SessionGuard::class, @@ -1855,7 +1848,6 @@ 'Spatie\LaravelSettings\SettingsMapper' => \Spatie\LaravelSettings\SettingsMapper::class, 'Spatie\LaravelSettings\SettingsRepositories\SettingsRepository' => \Spatie\LaravelSettings\SettingsRepositories\DatabaseSettingsRepository::class, 'Spatie\LaravelSettings\Support\SettingsCacheFactory' => \Spatie\LaravelSettings\Support\SettingsCacheFactory::class, - 'Squire\RepositoryManager' => \Squire\RepositoryManager::class, 'Symfony\Component\HtmlSanitizer\HtmlSanitizerInterface' => \Symfony\Component\HtmlSanitizer\HtmlSanitizer::class, 'auth' => \Illuminate\Auth\AuthManager::class, 'auth.driver' => \Illuminate\Auth\SessionGuard::class, @@ -2093,7 +2085,6 @@ 'Spatie\LaravelSettings\SettingsMapper' => \Spatie\LaravelSettings\SettingsMapper::class, 'Spatie\LaravelSettings\SettingsRepositories\SettingsRepository' => \Spatie\LaravelSettings\SettingsRepositories\DatabaseSettingsRepository::class, 'Spatie\LaravelSettings\Support\SettingsCacheFactory' => \Spatie\LaravelSettings\Support\SettingsCacheFactory::class, - 'Squire\RepositoryManager' => \Squire\RepositoryManager::class, 'Symfony\Component\HtmlSanitizer\HtmlSanitizerInterface' => \Symfony\Component\HtmlSanitizer\HtmlSanitizer::class, 'auth' => \Illuminate\Auth\AuthManager::class, 'auth.driver' => \Illuminate\Auth\SessionGuard::class, @@ -2331,7 +2322,6 @@ 'Spatie\LaravelSettings\SettingsMapper' => \Spatie\LaravelSettings\SettingsMapper::class, 'Spatie\LaravelSettings\SettingsRepositories\SettingsRepository' => \Spatie\LaravelSettings\SettingsRepositories\DatabaseSettingsRepository::class, 'Spatie\LaravelSettings\Support\SettingsCacheFactory' => \Spatie\LaravelSettings\Support\SettingsCacheFactory::class, - 'Squire\RepositoryManager' => \Squire\RepositoryManager::class, 'Symfony\Component\HtmlSanitizer\HtmlSanitizerInterface' => \Symfony\Component\HtmlSanitizer\HtmlSanitizer::class, 'auth' => \Illuminate\Auth\AuthManager::class, 'auth.driver' => \Illuminate\Auth\SessionGuard::class, @@ -2569,7 +2559,6 @@ 'Spatie\LaravelSettings\SettingsMapper' => \Spatie\LaravelSettings\SettingsMapper::class, 'Spatie\LaravelSettings\SettingsRepositories\SettingsRepository' => \Spatie\LaravelSettings\SettingsRepositories\DatabaseSettingsRepository::class, 'Spatie\LaravelSettings\Support\SettingsCacheFactory' => \Spatie\LaravelSettings\Support\SettingsCacheFactory::class, - 'Squire\RepositoryManager' => \Squire\RepositoryManager::class, 'Symfony\Component\HtmlSanitizer\HtmlSanitizerInterface' => \Symfony\Component\HtmlSanitizer\HtmlSanitizer::class, 'auth' => \Illuminate\Auth\AuthManager::class, 'auth.driver' => \Illuminate\Auth\SessionGuard::class, diff --git a/_ide_helper.php b/_ide_helper.php index e045d9225..91a39f1be 100644 --- a/_ide_helper.php +++ b/_ide_helper.php @@ -18665,7 +18665,18 @@ public static function sanitizeHtml() } - namespace Livewire { + namespace App\Helpers { + /** + * + * + */ + class TimeZoneHelper { + + } + +} + + namespace Livewire { /** * * @@ -26312,6 +26323,7 @@ class URL extends \Illuminate\Support\Facades\URL {} class Validator extends \Illuminate\Support\Facades\Validator {} class View extends \Illuminate\Support\Facades\View {} class Vite extends \Illuminate\Support\Facades\Vite {} + class TimeZoneHelper extends \App\Helpers\TimeZoneHelper {} class Livewire extends \Livewire\Livewire {} class Excel extends \Maatwebsite\Excel\Facades\Excel {} class Flare extends \Spatie\LaravelIgnition\Facades\Flare {} diff --git a/app/Filament/Pages/Settings/GeneralPage.php b/app/Filament/Pages/Settings/GeneralPage.php index 6c05cb8f0..da0683143 100644 --- a/app/Filament/Pages/Settings/GeneralPage.php +++ b/app/Filament/Pages/Settings/GeneralPage.php @@ -2,6 +2,7 @@ namespace App\Filament\Pages\Settings; +use App\Helpers\TimeZoneHelper; use App\Rules\Cron; use App\Settings\GeneralSettings; use Filament\Forms; @@ -9,7 +10,6 @@ use Filament\Pages\SettingsPage; use Illuminate\Support\Facades\Http; use Illuminate\Support\HtmlString; -use Squire\Models\Timezone; class GeneralPage extends SettingsPage { @@ -53,7 +53,7 @@ public function form(Form $form): Form ->columnSpan(['md' => 2]), Forms\Components\Select::make('timezone') ->label('Time zone') - ->options(Timezone::all()->pluck('code', 'code')) + ->options(TimeZoneHelper::list()) ->searchable() ->required(), Forms\Components\TextInput::make('time_format') diff --git a/app/Helpers/TimeZoneHelper.php b/app/Helpers/TimeZoneHelper.php new file mode 100644 index 000000000..e02f1ad77 --- /dev/null +++ b/app/Helpers/TimeZoneHelper.php @@ -0,0 +1,28 @@ + $value) { + date_default_timezone_set($value); + + $timezone[$value] = $value.' (UTC '.date('P', $timestamp).')'; + } + + return collect($timezone)->sortKeys(); + }); + } +} diff --git a/composer.json b/composer.json index 188d84d14..08ece5065 100644 --- a/composer.json +++ b/composer.json @@ -25,8 +25,7 @@ "livewire/livewire": "^3.2.6", "maatwebsite/excel": "^3.1.50", "maennchen/zipstream-php": "^2.4", - "spatie/laravel-settings": "^2.8.3", - "squirephp/timezones-en": "^3.4.4" + "spatie/laravel-settings": "^2.8.3" }, "require-dev": { "barryvdh/laravel-ide-helper": "^2.13", @@ -41,7 +40,8 @@ }, "autoload": { "files": [ - "app/helpers.php" + "app/helpers.php", + "app/Helpers/TimeZoneHelper.php" ], "psr-4": { "App\\": "app/", diff --git a/composer.lock b/composer.lock index 81f71d15d..5cf50eebe 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1da8fdae48b383e8100afec29a573c79", + "content-hash": "015b60b674d159a56f20c594b6dd76d2", "packages": [ { "name": "awcodes/filament-versions", @@ -6536,270 +6536,6 @@ ], "time": "2023-09-25T07:13:36+00:00" }, - { - "name": "squirephp/model", - "version": "v3.4.4", - "source": { - "type": "git", - "url": "https://github.com/squirephp/model.git", - "reference": "dbd3cd2fb74c36f6aabd9294de40a8f64c82518d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/squirephp/model/zipball/dbd3cd2fb74c36f6aabd9294de40a8f64c82518d", - "reference": "dbd3cd2fb74c36f6aabd9294de40a8f64c82518d", - "shasum": "" - }, - "require": { - "ext-pdo_sqlite": "*", - "illuminate/database": "^8.40|^9.0|^10.0", - "illuminate/support": "^8.0|^9.0|^10.0", - "php": "^8.0" - }, - "type": "library", - "extra": { - "laravel": { - "providers": [ - "Squire\\ModelServiceProvider" - ] - } - }, - "autoload": { - "psr-4": { - "Squire\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Dan Harrin", - "email": "dan@danharrin.com" - } - ], - "description": "A library containing the base Squire model class.", - "homepage": "https://github.com/squirephp", - "keywords": [ - "squire" - ], - "support": { - "issues": "https://github.com/squirephp/squire/issues", - "source": "https://github.com/squirephp/squire" - }, - "time": "2023-02-18T12:44:15+00:00" - }, - { - "name": "squirephp/repository", - "version": "v3.4.4", - "source": { - "type": "git", - "url": "https://github.com/squirephp/repository.git", - "reference": "dffe543ee093cdad29c776ae901eb5aa43ac371a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/squirephp/repository/zipball/dffe543ee093cdad29c776ae901eb5aa43ac371a", - "reference": "dffe543ee093cdad29c776ae901eb5aa43ac371a", - "shasum": "" - }, - "require": { - "illuminate/support": "^8.0|^9.0|^10.0", - "php": "^8.0" - }, - "type": "library", - "extra": { - "laravel": { - "providers": [ - "Squire\\RepositoryServiceProvider" - ], - "aliases": { - "RepositoryManager": "Squire\\Repository\\Facades\\Repository" - } - } - }, - "autoload": { - "psr-4": { - "Squire\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Dan Harrin", - "email": "dan@danharrin.com" - } - ], - "description": "A library containing the Squire repository.", - "homepage": "https://github.com/squirephp", - "keywords": [ - "squire" - ], - "support": { - "issues": "https://github.com/squirephp/squire/issues", - "source": "https://github.com/squirephp/squire" - }, - "time": "2023-02-18T12:44:39+00:00" - }, - { - "name": "squirephp/rule", - "version": "v3.4.4", - "source": { - "type": "git", - "url": "https://github.com/squirephp/rule.git", - "reference": "2a3d11385140e325dcfbcf48c864e1a02fa0c342" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/squirephp/rule/zipball/2a3d11385140e325dcfbcf48c864e1a02fa0c342", - "reference": "2a3d11385140e325dcfbcf48c864e1a02fa0c342", - "shasum": "" - }, - "require": { - "illuminate/contracts": "^8.0|^9.0|^10.0", - "illuminate/database": "^8.40|^9.0|^10.0", - "illuminate/support": "^8.0|^9.0|^10.0", - "php": "^8.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Squire\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Dan Harrin", - "email": "dan@danharrin.com" - } - ], - "description": "A library containing the base Squire rule class.", - "homepage": "https://github.com/squirephp", - "keywords": [ - "squire" - ], - "support": { - "issues": "https://github.com/squirephp/squire/issues", - "source": "https://github.com/squirephp/squire" - }, - "time": "2023-02-18T12:44:38+00:00" - }, - { - "name": "squirephp/timezones", - "version": "v3.4.4", - "source": { - "type": "git", - "url": "https://github.com/squirephp/timezones.git", - "reference": "5dc7f8c7f632c64a8013ba964ffe2621c3bca27e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/squirephp/timezones/zipball/5dc7f8c7f632c64a8013ba964ffe2621c3bca27e", - "reference": "5dc7f8c7f632c64a8013ba964ffe2621c3bca27e", - "shasum": "" - }, - "require": { - "illuminate/support": "^8.0|^9.0|^10.0", - "php": "^8.0", - "squirephp/model": "self.version", - "squirephp/rule": "self.version" - }, - "type": "library", - "extra": { - "laravel": { - "providers": [ - "Squire\\TimezonesServiceProvider" - ] - } - }, - "autoload": { - "psr-4": { - "Squire\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Dan Harrin", - "email": "dan@danharrin.com" - } - ], - "description": "A library containing Squire's Timezone model.", - "homepage": "https://github.com/squirephp", - "keywords": [ - "squire" - ], - "support": { - "issues": "https://github.com/squirephp/squire/issues", - "source": "https://github.com/squirephp/squire" - }, - "time": "2023-02-18T12:44:40+00:00" - }, - { - "name": "squirephp/timezones-en", - "version": "v3.4.4", - "source": { - "type": "git", - "url": "https://github.com/squirephp/timezones-en.git", - "reference": "b321f830f358f98675be639e84b213a5345950d1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/squirephp/timezones-en/zipball/b321f830f358f98675be639e84b213a5345950d1", - "reference": "b321f830f358f98675be639e84b213a5345950d1", - "shasum": "" - }, - "require": { - "illuminate/support": "^8.0|^9.0|^10.0", - "php": "^8.0", - "squirephp/repository": "self.version", - "squirephp/timezones": "self.version" - }, - "type": "library", - "extra": { - "laravel": { - "providers": [ - "Squire\\TimezonesEnServiceProvider" - ] - } - }, - "autoload": { - "psr-4": { - "Squire\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Dan Harrin", - "email": "dan@danharrin.com" - } - ], - "description": "A library containing the English translation of Squire's Timezone model.", - "homepage": "https://github.com/squirephp", - "keywords": [ - "squire" - ], - "support": { - "issues": "https://github.com/squirephp/squire/issues", - "source": "https://github.com/squirephp/squire" - }, - "time": "2023-02-18T12:44:38+00:00" - }, { "name": "symfony/console", "version": "v6.4.1", diff --git a/config/app.php b/config/app.php index 7301e08bb..7beedc5ac 100644 --- a/config/app.php +++ b/config/app.php @@ -186,6 +186,7 @@ 'aliases' => Facade::defaultAliases()->merge([ // 'ExampleClass' => App\Example\ExampleClass::class, + 'TimeZoneHelper' => App\Helpers\TimeZoneHelper::class, ])->toArray(), ];