-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: set currency and timezone for new users #1657
Conversation
…a into feat/set-default-currency
What's the goal of this PR? |
Default currency is USD, and default timezone is UTC for everyone. We can set these settings by detecting the current location of the user. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How will it work in a local instance, as we don't have access to CloudFlare locally?
app/Helpers/CountriesHelper.php
Outdated
@@ -59,4 +64,118 @@ private static function getCommonNameLocale($country) | |||
array_get($country, 'name.common', '') | |||
); | |||
} | |||
|
|||
private static function getCountry($iso) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you provide a description of what the method does?
app/Helpers/CountriesHelper.php
Outdated
return $country; | ||
} | ||
|
||
public static function getDefaultCountryFromLang($locale) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description (BlockDoc)?
Should it be named FromLocale
instead?
app/Models/User/User.php
Outdated
if (is_null($country)) { | ||
$user->timezone = config('app.timezone'); | ||
} else { | ||
foreach ($country->currencies as $currencie) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$currencie
--> $currency
…a into feat/set-default-currency
…a into feat/set-default-currency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pull request has been automatically locked since there |
Set currency and timezone for a new User, depending of its current connected country timezone, or locale.