How can I add a field called telephone to the validator? Laravel 5.6

0

I'm having a problem wanting to add my field telefono in validator of table user in controller RegisterController

protected function validator(array $data)
{
    return Validator::make($data, [
        'name' => 'required|string|max:255',
        'email' => 'required|string|email|max:255|unique:users',
        'password' => 'required|string|min:6|confirmed',
        'telefono' => 'required|string|telefono|max:100|unique:users',

    ]);
}

protected function create(array $data)
{
    return User::create([
        'name' => $data['name'],
        'email' => $data['email'],
        'password' => bcrypt($data['password']),
        'telefono' => $data['telefono'],
    ]);
}

I do not see what the error is or if I'm missing something but it throws me the error:

  

BadMethodCallException Method [validateTelefono] does not exist.

    
asked by Hernan Chaparro 17.07.2018 в 19:53
source

0 answers