Created
April 7, 2021 20:33
-
-
Save tomshaw/5ea727b1f29ee64ec79352758822607c to your computer and use it in GitHub Desktop.
Laravel telephone number validators.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$this->validate($request, [ | |
'phone' => 'required|digits:10' | |
]); | |
$this->validate($request, [ | |
'phone' => 'required|numeric|between:9,11' | |
]); | |
$this->validate($request, [ | |
'phone' => 'required|min:10|numeric' | |
]); | |
$this->validate($request, [ | |
'phone' => 'required|regex:/(01)[0-9]{9}/' | |
]); | |
$this->validate($request, [ | |
'phone' => 'required|regex:/^([0-9\s\-\+\(\)]*)$/|min:10' | |
]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment