Validator::extend('email_or_phone', function ($attribute, $value, $parameters, $validator) { return $validator->validateDigitsBetween($attribute, $value, [8, 10]) || $validator->validateEmail($attribute, $value, []); });