Friday, March 10, 2017

laravel validation doesn't work with none required fields

I have problem with my laravel valdation

the problem is :

I have two none required fields ( password and birthday )

 public function rules()
    {
        return [
            'name'=>'required',
            'email'=>'required|email|unique:users,email,'.Auth::id(),
            'birthday'=>'date',
            'password'=>'confirmed|min:6',

        ];
    }

I can't pass the birthday and the password of they are empty

the error is

The birthday is not a valid date.
The password must be at least 6 characters.

I did dd(Input::All()) inside the rules function and both fields are empty ( null )

any idea about this problem ? ? ?



via yasmin

Advertisement