I'm trying to avoid modifying the vendor package for this problem. When I add custom fields and call my custom validator, I can't confirm the user's email with the confirmation code due to the validation rules. Currently using this for my custom validation in app/models/UserValidator.php:
<?php
use Zizaco\Confide\UserValidator as ConfideUserValidator;
use Zizaco\Confide\UserValidatorInterface;
class UserValidator extends ConfideUserValidator implements UserValidatorInterface {
// Custom rules for account validation
public $rules = [
'create' => [
'first_name' => 'required|alpha|max:100',
'last_name' => 'required|alpha|max:100',
'username' => 'required|min:3|max:20|alpha_dash',
'email' => 'required|email|unique:users|max:100',
'password' => 'required|min:8',
],
'update' => [
'username' => 'required|min:3|max:20|alpha_dash',
'email' => 'required|email|unique:users|max:100',
'password' => 'required|min:8',
]
];
}
I can create the account perfectly fine, it's just the confirmation that won't work. I backtraced it to vendor/zizaco/confide/src/Confide/ConfideUser.php - I found if I comment out this under the save function:
if ($this->isValid()) {
return parent::save($options);
}
return false;
and replace it temporarily with this:
return parent::save($options);
then everything will work as it's supposed to. Am I missing something here? Should the update rule have something regarding the confirmed column?
EDIT: Providing a blank array for the update ruleset gets rid of the error, but I need to validate these fields when a user updates their profile..