Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel validate telephone number

SEVERAL WAYS TO DO IT:
------
* by using regex in the suitable Laravel Controller:

'phone' => 'required|regex:/(01)[0-9]{9}/' => ( add 'required' only if the field is required, else delete it!)
OR smthin like dis
'phone_number' => 'required|regex:/^([0-9s-+()]*)$/|min:10'
---------
* use this library: https://github.com/propaganistas/laravel-phone
---------
* use this in the corresponding laravel Controller:

 'phone' => 'required | numeric | digits:10 | starts_with: 6,7,8,9'
---------
* You can use a service like Nexmo or Twilio if you need to properly validate phone numbers.
Comment

mobile number validation in laravel 8

'mobile' => 'required|min:10|max:10',
Comment

laravel form validation phone number

'phone' => 'required|regex:/(01)[0-9]{9}/'
Comment

mobile number validation in laravel 8

'mobile' => 'required|digits:10'
Comment

validate phone number with dial code laravel 8

'mobile' => ['required', function ($attribute, $value, $fail) use ($parameters) {
                if (($value + strlen($parameters['code'])) < 15) {
                    $fail('Mobile number is too long');
                }
            }
Comment

PREVIOUS NEXT
Code Example
Php :: php time 
Php :: implode array keys in php 
Php :: how to run multiple seeder at a time in laravel 
Php :: php get function name 
Php :: redirect in php 
Php :: add time to a date php 
Php :: laravel make model all with resources api 
Php :: calculate days of a month 
Php :: how to get ip address of pc in php 
Php :: contains php 
Php :: 419 page expired laravel 
Php :: tableau aléatoire php 
Php :: bycrypt password php 
Php :: round to 2 decimal places php 
Php :: get next month first day php 
Php :: excerpt more wordpress 
Php :: install logger bundle in symfony project 
Php :: laravel query builder get last insert id 
Php :: limiting requests to controllers in laravel 
Php :: laravel create request 
Php :: upload multiple files in codeigniter 
Php :: php error stack overflow 
Php :: laravel upload base64 image 
Php :: get current authenticated user laravel 
Php :: get unique array from multidimentional array by value in php 
Php :: custom rule laravel validation 
Php :: diffinhours with minutes carbon 
Php :: laravel collection toQuery 
Php :: yii2 clear schema cache 
Php :: Get all Country List using php 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =