Validation of Phone Number using Laravel - laravel-6

i want to validate phone number like-
1.Only Bangladesh Mobile no is valid like, +880, 017,015,016,019,014
2 mobile no length also be valid like 11 digit
if prefix is 01, 13 digit if prefix is 88, 14 digit if prefix is +880
so what is the validation code in laravel 6?
Thanks in advance

Related

Angular 14 how to format number input in ibm carbon number input with commas

I am using Angular14 with ibm carbon design system.
<ibm-number
[label]="label"
[helperText]="[helperText]"
[theme]="theme"
[min]="min"
[max]="max"
[step]="step"
[precision]="precision"
[invalid]="invalid"
[invalidText]="invalidText"
[warn]="warn"
[warnText]="warnText"
[size]="size"
[disabled]="disabled">
</ibm-number>
for eg: want to display a number as : 123,123,123
I would like to format the number with comma separated after 3 numbers. Couldnt find any documentation in ibm. Is there a way in angular with custom directives we can format this number input with comma separated?
Can anyone please help me with this to show how to achieve this?
Thanks

Api to trim the 12 digit phone number to ten digits?

we have issue where we have an api which accepts only 10 digits. But in our SMS panel we have made to store the 12 digits.ex:910123456789 And now client side it's triggering an error saying where it accepts only 10 digits. So can i trim the first two numbers and send it through an api?
You can achieve it using a simple built in function in php (as your comment says you are using php) as below:
<?php
echo substr("910123456789",10);
//output will be 0123456789
?>
Ref: http://php.net/manual/en/function.substr.php

Create custom validation with three different error messages

I need to create a validation on an email field, i am using MVC 4.
I would use a simple regular expression, however as you see below i need to show three different error messages depending of the input on email field.
Validation Rules:
1)If the # sign is not present in the email address, display the message: # sign is required.
2) If no period (.) is entered, display the message: Period (.) after the # sign is required.
3) If 2 characters are not present after the period, display the message: Must contain at least 2 characters after the period.

How to change registration requirement for user ID in chat function

Hi when I run the sample chat function provided by quickblox, it contains several built-in limitation for username registration, for example, I need to have a certain number of characters or type of characters in order to register. I'm wondering which files contain those registration and display of error messages (I only found a class called "errors" in SignUpViewController ) and how do I change those limitations?
There are 2 ways:
Sign Up & then Sign In with email
Sign Up & then Sign In with login - Login field should contain alphanumeric and punctuation characters only
Is it OK? Or you have problem with other User's field?

Rails - How do you stop custom validators from running on optional fields?

I have a model called Client which runs a custom phone number validator to see if a given phone number is valid (validates :phone_number, :run_custom_validator => true). The problem is that this phone number field should not be required, its optional, but the validator runs every time even when no phone number is given. How do I get the validator to run only when a phone number is given? Any responses would be much appreciated! Thanks!
In the custom phone number validator, on the first line put the following:
return if phone_number.blank?