From 6816152d2140d911baa9b4897f3e54f0cf6f5c90 Mon Sep 17 00:00:00 2001 From: kyledoesdev Date: Sat, 6 Sep 2025 15:32:22 -0400 Subject: [PATCH 1/2] essentials command added --- app/Console/Commands/CreateAction.php | 24 ------ .../Controllers/Prezet/ShowController.php | 3 +- app/Libraries/Helpers.php | 17 ---- app/Livewire/Forms/LoginForm.php | 2 +- app/Providers/AppServiceProvider.php | 4 - composer.json | 1 + composer.lock | 80 ++++++++++++++++++- 7 files changed, 80 insertions(+), 51 deletions(-) delete mode 100644 app/Console/Commands/CreateAction.php delete mode 100644 app/Libraries/Helpers.php diff --git a/app/Console/Commands/CreateAction.php b/app/Console/Commands/CreateAction.php deleted file mode 100644 index 77b49a2..0000000 --- a/app/Console/Commands/CreateAction.php +++ /dev/null @@ -1,24 +0,0 @@ - $document->getKey(), 'ip_address' => $request->ip(), ], [ - 'timezone' => Helpers::tz(), + 'timezone' => timezone(), 'last_viewed_at' => now(), ]); diff --git a/app/Libraries/Helpers.php b/app/Libraries/Helpers.php deleted file mode 100644 index f00379d..0000000 --- a/app/Libraries/Helpers.php +++ /dev/null @@ -1,17 +0,0 @@ -ip(); - - if (config('app.env') !== 'production') { - return 'America/New_York'; - } - - return json_decode(file_get_contents($ip), true)['timezone']; - } -} diff --git a/app/Livewire/Forms/LoginForm.php b/app/Livewire/Forms/LoginForm.php index 4f15fb9..c612825 100644 --- a/app/Livewire/Forms/LoginForm.php +++ b/app/Livewire/Forms/LoginForm.php @@ -43,7 +43,7 @@ public function authenticate(): void RateLimiter::clear($this->throttleKey()); - auth()->user()->update(['timezone' => Helpers::tz()]); + auth()->user()->update(['timezone' => timezone()]); (new SearchSpotify)->refreshToken(auth()->user()); (new SearchCategories)->refreshToken(auth()->user()); diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 7e07af5..922cae0 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -38,10 +38,6 @@ public function boot(): void $event->extendSocialite('twitch', TwitchProvider::class); }); - Carbon::macro('inUserTimezone', function () { - return $this->tz(auth()->user()?->timezone ?? 'America/New_York'); - }); - Health::checks([ EnvironmentCheck::new(), DatabaseCheck::new(), diff --git a/composer.json b/composer.json index e89bf60..e1d6897 100644 --- a/composer.json +++ b/composer.json @@ -11,6 +11,7 @@ "require": { "php": "^8.2", "intervention/image": "^3.11", + "kyledoesdev/essentials": "^0.0.1", "laravel/framework": "^12.16", "laravel/nightwatch": "^1.8", "laravel/socialite": "^5.18", diff --git a/composer.lock b/composer.lock index 034c7ce..a4a5fa0 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": "85e51dbe7d1bbeef02ca5bedf1b4aacd", + "content-hash": "74473ed3ba66599c4eb33d00e7ce4fb4", "packages": [ { "name": "aws/aws-crt-php", @@ -1483,6 +1483,80 @@ ], "time": "2025-05-22T17:26:23+00:00" }, + { + "name": "kyledoesdev/essentials", + "version": "v0.0.1", + "source": { + "type": "git", + "url": "https://github.com/kyledoesdev/essentials.git", + "reference": "f8db9a02d797529dac2f62058d26f010b93da7c3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kyledoesdev/essentials/zipball/f8db9a02d797529dac2f62058d26f010b93da7c3", + "reference": "f8db9a02d797529dac2f62058d26f010b93da7c3", + "shasum": "" + }, + "require": { + "guzzlehttp/guzzle": "^7.8", + "illuminate/contracts": "^12.0", + "illuminate/http": "^12.0", + "illuminate/support": "^12.0", + "php": "^8.4", + "spatie/laravel-package-tools": "^1.16" + }, + "require-dev": { + "laravel/pint": "^1.14", + "nunomaduro/collision": "^8.8", + "orchestra/testbench": "^10.0.0", + "pestphp/pest": "^4.0", + "pestphp/pest-plugin-arch": "^4.0", + "pestphp/pest-plugin-laravel": "^4.0" + }, + "type": "library", + "extra": { + "laravel": { + "aliases": { + "Essentials": "Kyledoesdev\\Essentials\\Facades\\Essentials" + }, + "providers": [ + "Kyledoesdev\\Essentials\\EssentialsServiceProvider" + ] + } + }, + "autoload": { + "files": [ + "src/Libraries/helpers.php" + ], + "psr-4": { + "Kyledoesdev\\Essentials\\": "src/", + "Kyledoesdev\\Essentials\\Database\\Factories\\": "database/factories/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kyle Evangelisto", + "email": "kyledoesdev@gmail.com", + "role": "Developer" + } + ], + "description": "Essentials for my Laravel applications.", + "homepage": "https://github.com/kyledoesdev/essentials", + "keywords": [ + "essentials", + "kyledoesdev", + "laravel" + ], + "support": { + "issues": "https://github.com/kyledoesdev/essentials/issues", + "source": "https://github.com/kyledoesdev/essentials/tree/v0.0.1" + }, + "time": "2025-09-06T18:42:11+00:00" + }, { "name": "laravel/framework", "version": "v12.16.0", @@ -11254,12 +11328,12 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": true, "prefer-lowest": false, "platform": { "php": "^8.2" }, - "platform-dev": [], + "platform-dev": {}, "plugin-api-version": "2.6.0" } From 9ad092b361769ae061c7e78a18ba41c60e79b8ad Mon Sep 17 00:00:00 2001 From: kyledoesdev Date: Sat, 6 Sep 2025 15:34:39 -0400 Subject: [PATCH 2/2] published the config --- config/essentials.php | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 config/essentials.php diff --git a/config/essentials.php b/config/essentials.php new file mode 100644 index 0000000..9781468 --- /dev/null +++ b/config/essentials.php @@ -0,0 +1,7 @@ + [ + 'local_envs' => explode(',', (string) env('LOCAL_ENVS', 'local,development,dev')), + ], +];