Fixes for phone validation

This commit is contained in:
David Bomba 2022-12-08 10:38:52 +11:00
parent a0208c8031
commit dff9c9566c
3 changed files with 13 additions and 12 deletions

View File

@ -35,17 +35,13 @@ class UpdateVendorRequest extends Request
{ {
/* Ensure we have a client name, and that all emails are unique*/ /* Ensure we have a client name, and that all emails are unique*/
$rules['country_id'] = 'integer|nullable'; $rules['country_id'] = 'integer';
if ($this->number) { if ($this->number) {
$rules['number'] = Rule::unique('vendors')->where('company_id', auth()->user()->company()->id)->ignore($this->vendor->id); $rules['number'] = Rule::unique('vendors')->where('company_id', auth()->user()->company()->id)->ignore($this->vendor->id);
} }
// if($this->id_number)
// $rules['id_number'] = Rule::unique('vendors')->where('company_id', auth()->user()->company()->id)->ignore($this->vendor->id);
$rules['contacts.*.email'] = 'nullable|distinct'; $rules['contacts.*.email'] = 'nullable|distinct';
// $rules['id_number'] = 'unique:vendors,id_number,'.$this->id.',id,company_id,'.auth()->user()->company()->id;
return $rules; return $rules;
} }
@ -67,6 +63,9 @@ class UpdateVendorRequest extends Request
$input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']); $input['assigned_user_id'] = $this->decodePrimaryKey($input['assigned_user_id']);
} }
if(array_key_exists('country_id', $input) && is_null($input['country_id']))
unset($input['country_id']);
$input = $this->decodePrimaryKeys($input); $input = $this->decodePrimaryKeys($input);
$this->replace($input); $this->replace($input);

View File

@ -167,7 +167,7 @@ class Import implements ShouldQueue
public $tries = 1; public $tries = 1;
public $timeout = 0; public $timeout = 10000000;
// public $backoff = 86430; // public $backoff = 86430;
@ -188,10 +188,10 @@ class Import implements ShouldQueue
$this->resources = $resources; $this->resources = $resources;
} }
public function middleware() // public function middleware()
{ // {
return [new WithoutOverlapping("only_one_migration_at_a_time_ever")]; // return [new WithoutOverlapping("only_one_migration_at_a_time_ever")];
} // }
/** /**
* Execute the job. * Execute the job.

View File

@ -59,8 +59,10 @@ class UserRepository extends BaseRepository
// if(array_key_exists('oauth_provider_id', $details)) // if(array_key_exists('oauth_provider_id', $details))
// unset($details['oauth_provider_id']); // unset($details['oauth_provider_id']);
if (request()->has('validated_phone')) if (request()->has('validated_phone')){
$details['phone'] = request()->input('validated_phone'); $details['phone'] = request()->input('validated_phone');
$user->verified_phone_number = false;
}
$user->fill($details); $user->fill($details);