File tree Expand file tree Collapse file tree 4 files changed +13
-0
lines changed Expand file tree Collapse file tree 4 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ APP_ENV=local
3
3
APP_KEY = base64:jpd/wy450S/8N0y6OfuRoZ8yS3AWEzrbkSgo08djF4w=
4
4
APP_DEBUG = true
5
5
APP_URL = http://laravel-inertia-template.test
6
+ APP_TIMEZONE_DISPLAY = " Europe/London"
6
7
7
8
SEED_SUPER_ADMIN_EMAIL = super@laravel-inertia-template.test
8
9
SEED_ADMIN_EMAIL = admin@laravel-inertia-template.test
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ APP_ENV=testing
3
3
APP_KEY = base64:PGFsMHQa3kYad6OZbsaYzBnrdzxN3x+sfkkmqogVDuk=
4
4
APP_DEBUG = true
5
5
APP_URL = http://laravel-inertia-template.test
6
+ APP_TIMEZONE_DISPLAY = " Europe/London"
6
7
7
8
BCRYPT_ROUNDS = 4
8
9
Original file line number Diff line number Diff line change 3
3
namespace App \Providers ;
4
4
5
5
use App \Models \User ;
6
+ use Carbon \Carbon ;
6
7
use Illuminate \Http \Resources \Json \JsonResource ;
7
8
use Illuminate \Support \ServiceProvider ;
8
9
use Laravel \Pulse \Facades \Pulse ;
@@ -24,6 +25,14 @@ public function boot(): void
24
25
{
25
26
JsonResource::withoutWrapping ();
26
27
28
+ Carbon::macro ('inAppTimezone ' , function () {
29
+ return $ this ->tz (config ('app.timezone_display ' ));
30
+ });
31
+
32
+ Carbon::macro ('inUserTimezone ' , function () {
33
+ return $ this ->tz (auth ()->user ()?->timezone ?? config ('app.timezone_display ' ));
34
+ });
35
+
27
36
// @codeCoverageIgnoreStart
28
37
Pulse::users (function ($ ids ) {
29
38
return User::findMany ($ ids )->map (fn ($ user ) => [
Original file line number Diff line number Diff line change 67
67
68
68
'timezone ' => env ('APP_TIMEZONE ' , 'UTC ' ),
69
69
70
+ 'timezone_display ' => env ('APP_TIMEZONE_DISPLAY ' , 'UTC ' ),
71
+
70
72
/*
71
73
|--------------------------------------------------------------------------
72
74
| Application Locale Configuration
You can’t perform that action at this time.
0 commit comments