micky
micky

Reputation: 317

Using regex for validation

I am trying to validate the telephone number using the regix. but it is giving me error:

  $validator=Validator::make($request->all(),[
        'name'=>'required',
        'telephone'=>'regix:^[[0-9]\-\+]{9,15}$|required|unique:telephone',
        'email'=>'unique:telephone',]);

the error is:

Method [validateRegix] does not exist.

Upvotes: 0

Views: 96

Answers (2)

nospor
nospor

Reputation: 4220

regix does not exist. regex exists.

Upvotes: 1

Prashant G Patil
Prashant G Patil

Reputation: 977

$validator=Validator::make($request->all(),[
    'name'=>'required',
    'telephone'=>'regex:^[[0-9]\-\+]{9,15}$|required|unique:telephone',
    'email'=>'unique:telephone',]);

Upvotes: 4

Related Questions