fix: country code was broken when a user submitted a code so the validation rules were always in FR
This commit is contained in:
parent
37a75e8680
commit
0f1c71272b
1 changed files with 3 additions and 6 deletions
|
|
@ -50,12 +50,9 @@ class CreateAccountRequest extends FormRequest
|
|||
$authUser = auth('frontend')->user();
|
||||
$countryCode = null;
|
||||
|
||||
if (request()->isMethod('get') && $authUser) {
|
||||
$countryCode = (new CrmRepository())->fetchCrmCustomer($authUser)->country->value;
|
||||
}
|
||||
if (request()->isMethod('post') || request()->isMethod('put')) {
|
||||
$countryCode = $this->integer('country');
|
||||
}
|
||||
$countryCode = $this->integer('country') != 0 ?
|
||||
$this->integer('country') : ($authUser ?
|
||||
(new CrmRepository())->fetchCrmCustomer($authUser)->country->value : 0);
|
||||
$countryRules = match ($countryCode) {
|
||||
Country::belgium()->value => [
|
||||
'phone' => 'phone:BE',
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue