Changes Done

This commit is contained in:
Devansh 2021-12-29 18:25:35 +05:30
parent 011c90bfc5
commit a1bda30db1
16 changed files with 77 additions and 40 deletions

View File

@ -0,0 +1,30 @@
<?php
namespace Webkul\Core\Contracts\Validations;
use Illuminate\Contracts\Validation\Rule;
class Address implements Rule
{
/**
* Determine if the validation rule passes.
*
* @param string $attribute
* @param mixed $value
* @return bool
*/
public function passes($attribute, $value)
{
return preg_match('/^[a-zA-Z0-9\s\-\,]+$/', $value);
}
/**
* Get the validation error message.
*
* @return string
*/
public function message()
{
return trans('core::validation.address');
}
}

View File

@ -3,6 +3,6 @@
return [
'path-hint' => [
'template' => 'Template',
'parents' => 'Parents'
]
'parents' => 'Parents',
],
];

View File

@ -1,9 +1,10 @@
<?php
return [
'address' => 'The :attribute can only accept alpha, numeric, spaces, comma and dashes.',
'alpha-numeric-space' => 'The :attribute can only accept alpha, numeric and spaces.',
'code' => 'The :attribute must be valid.',
'decimal' => 'The :attribute must be valid.',
'phone-number' => 'The :attribute must be valid phone number.',
'slug' => 'The :attribute must be valid slug.',
'code' => 'The :attribute must be valid.',
'decimal' => 'The :attribute must be valid.',
'phone-number' => 'The :attribute must be valid phone number.',
'slug' => 'The :attribute must be valid slug.',
];

View File

@ -3,6 +3,6 @@
return [
'path-hint' => [
'template' => 'Plantilla',
'parents' => 'Padres'
]
'parents' => 'Padres',
],
];

View File

@ -1,9 +1,10 @@
<?php
return [
'address' => 'The :attribute can only accept alpha, numeric, spaces, comma and dashes.',
'alpha-numeric-space' => 'The :attribute can only accept alpha, numeric and spaces.',
'code' => 'O :attribute debe ser válido.',
'decimal' => 'O :attribute debe ser válido.',
'phone-number' => 'The :attribute must be valid phone number.',
'slug' => 'O :attribute debe tener un slug válido.',
'code' => 'O :attribute debe ser válido.',
'decimal' => 'O :attribute debe ser válido.',
'phone-number' => 'The :attribute must be valid phone number.',
'slug' => 'O :attribute debe tener un slug válido.',
];

View File

@ -1,7 +1,7 @@
<?php
return [
'slug' => ':attribute باید نامک معتبر داشته باشد.',
'code' => ':attribute باید معتبر باشد.',
'decimal' => ':attribute باید معتبر باشد.'
'slug' => ':attribute باید نامک معتبر داشته باشد.',
'code' => ':attribute باید معتبر باشد.',
'decimal' => ':attribute باید معتبر باشد.',
];

View File

@ -1,9 +1,10 @@
<?php
return [
'address' => 'The :attribute can only accept alpha, numeric, spaces, comma and dashes.',
'alpha-numeric-space' => 'The :attribute can only accept alpha, numeric and spaces.',
'code' => 'The :attribute must be valid.',
'decimal' => 'The :attribute must be valid.',
'phone-number' => 'The :attribute must be valid phone number.',
'slug' => 'The :attribute must be valid slug.',
'code' => 'The :attribute must be valid.',
'decimal' => 'The :attribute must be valid.',
'phone-number' => 'The :attribute must be valid phone number.',
'slug' => 'The :attribute must be valid slug.',
];

View File

@ -3,6 +3,6 @@
return [
'path-hint' => [
'template' => 'Template',
'parents' => 'Parents'
]
'parents' => 'Parents',
],
];

View File

@ -1,9 +1,10 @@
<?php
return [
'address' => 'The :attribute can only accept alpha, numeric, spaces, comma and dashes.',
'alpha-numeric-space' => 'The :attribute can only accept alpha, numeric and spaces.',
'code' => ':attribute deve essere valido.',
'decimal' => ':attribute deve essere valido.',
'phone-number' => 'The :attribute must be valid phone number.',
'slug' => ':attribute deve essere uno slug valido.',
'code' => ':attribute deve essere valido.',
'decimal' => ':attribute deve essere valido.',
'phone-number' => 'The :attribute must be valid phone number.',
'slug' => ':attribute deve essere uno slug valido.',
];

View File

@ -3,6 +3,6 @@
return [
'path-hint' => [
'template' => 'Template',
'parents' => 'Parents'
]
'parents' => 'Parents',
],
];

View File

@ -1,9 +1,10 @@
<?php
return [
'address' => 'The :attribute can only accept alpha, numeric, spaces, comma and dashes.',
'alpha-numeric-space' => 'The :attribute can only accept alpha, numeric and spaces.',
'code' => 'O :attribute precisa ser válido.',
'decimal' => 'O :attribute precisa ser válido.',
'phone-number' => 'The :attribute must be valid phone number.',
'slug' => 'O :attribute precisa ter um slug válido.',
'code' => 'O :attribute precisa ser válido.',
'decimal' => 'O :attribute precisa ser válido.',
'phone-number' => 'The :attribute must be valid phone number.',
'slug' => 'O :attribute precisa ter um slug válido.',
];

View File

@ -3,6 +3,6 @@
return [
'path-hint' => [
'template' => 'Template',
'parents' => 'Parents'
]
'parents' => 'Parents',
],
];

View File

@ -1,9 +1,10 @@
<?php
return [
'address' => 'The :attribute can only accept alpha, numeric, spaces, comma and dashes.',
'alpha-numeric-space' => 'The :attribute can only accept alpha, numeric and spaces.',
'code' => ':attribute değeri geçerli olmalı.',
'decimal' => ':attribute geçerli olmalı.',
'phone-number' => 'The :attribute must be valid phone number.',
'slug' => ':attribute değeri geçerli bir url olmalı.',
'code' => ':attribute değeri geçerli olmalı.',
'decimal' => ':attribute geçerli olmalı.',
'phone-number' => 'The :attribute must be valid phone number.',
'slug' => ':attribute değeri geçerli bir url olmalı.',
];

View File

@ -3,6 +3,7 @@
namespace Webkul\Customer\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Webkul\Core\Contracts\Validations\Address;
use Webkul\Core\Contracts\Validations\AlphaNumericSpace;
use Webkul\Core\Contracts\Validations\PhoneNumber;
use Webkul\Customer\Rules\VatIdRule;
@ -31,7 +32,7 @@ class CustomerAddressRequest extends FormRequest
'first_name' => ['required', new AlphaNumericSpace],
'last_name' => ['required', new AlphaNumericSpace],
'address1' => ['required', 'array'],
'address1.*' => ['required', new AlphaNumericSpace],
'address1.*' => ['required', new Address],
'country' => ['required', 'alpha'],
'state' => ['required', 'alpha'],
'city' => ['required'],

View File

@ -83,7 +83,7 @@
<input type="text" class="control" name="address1[]" value="{{ $addresses[0] ?? '' }}" id="address1" v-validate="'required'" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.street-address') }}&quot;">
<span class="control-error" v-if="errors.has('address1[]')">@{{ errors.first('address1[]') }}</span>
<span class="control-error" v-text="'{{ $errors->first('address1.*') }}'"></span>
</div>
@if (core()->getConfigData('customer.settings.address.street_lines') && core()->getConfigData('customer.settings.address.street_lines') > 1)

View File

@ -79,7 +79,7 @@
<input type="text" class="control" name="address1[]" id="address_0" v-validate="'required'" value="{{ $addresses[0] ?? '' }}" data-vv-as="&quot;{{ __('shop::app.customer.account.address.create.street-address') }}&quot;">
<span class="control-error" v-if="errors.has('address1[]')">@{{ errors.first('address1[]') }}</span>
<span class="control-error" v-text="'{{ $errors->first('address1.*') }}'"></span>
</div>
@if (core()->getConfigData('customer.settings.address.street_lines') && core()->getConfigData('customer.settings.address.street_lines') > 1)