File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717 ],
1818 "require" : {
1919 "php" : " ^8.4" ,
20- "spatie/laravel-package-tools" : " ^1.16" ,
2120 "illuminate/contracts" : " ^12.0" ,
2221 "illuminate/support" : " ^12.0" ,
2322 "illuminate/http" : " ^12.0" ,
24- "guzzlehttp/guzzle " : " ^7.8 "
23+ "spatie/laravel-package-tools " : " ^1.16 "
2524 },
2625 "require-dev" : {
2726 "laravel/pint" : " ^1.14" ,
7271 },
7372 "minimum-stability" : " dev" ,
7473 "prefer-stable" : true
75- }
74+ }
Original file line number Diff line number Diff line change @@ -14,10 +14,28 @@ function timezone(): string
1414 return $ tz ;
1515 }
1616
17- $ response = Http::get ('http://ip-api.com/json/ ' .request ()->ip ());
17+ $ response = Http::timeout (3 )
18+ ->retry (1 , 200 )
19+ ->get ('http://ip-api.com/json/ ' .request ()->ip ());
1820
1921 return $ response ->successful ()
2022 ? $ response ->json ('timezone ' , $ tz )
2123 : $ tz ;
2224 }
2325}
26+
27+ if (! function_exists ('zuck ' )) {
28+ /**
29+ * Get the user packet data
30+ */
31+ function user_packet (): array
32+ {
33+ $ response = Http::timeout (3 )
34+ ->retry (1 , 200 )
35+ ->get ('http://ip-api.com/json/ ' .request ()->ip ());
36+
37+ return $ response ->successful ()
38+ ? $ response ->json ()
39+ : [];
40+ }
41+ }
Original file line number Diff line number Diff line change @@ -10,9 +10,15 @@ class MacroServiceProvider extends ServiceProvider
1010 public function boot (): void
1111 {
1212 Carbon::macro ('inUserTimezone ' , function () {
13- $ user = auth ()->user ();
14-
15- return $ this ->tz ($ user ?->timezone ?? timezone ());
13+ $ timezone = auth ()->user ()?->timezone ?? session ()->get ('____tz ' );
14+
15+ if (is_null ($ timezone )) {
16+ $ timezone = timezone ();
17+
18+ session ()->put (['____tz ' => $ timezone ]);
19+ }
20+
21+ return $ this ->tz ($ timezone );
1622 });
1723 }
1824}
You can’t perform that action at this time.
0 commit comments