/** * Get the validator instance for the request. * @return \Illuminate\Validation\Validator */ protected function getValidatorInstance() { $instance = parent::getValidatorInstance(); if (method_exists($this, 'prepareValidator')) { $this->prepareValidator($instance); } return $instance; }
public function getValidatorInstance() { $validator = parent::getValidatorInstance(); $validator->after(function () use($validator) { $input = $this->formatInput(); $checkcode = trim(strtoupper($input['checkcode'])); if ($checkcode[2] != '-' || strlen($checkcode) != 9) { $validator->errors()->add('checkcode', 'profile.invalide-code-format'); return $validator; } $localuser = UserProfile::findLocalUserByVerificationCode($input['checkcode']); if ($localuser == null) { $validator->errors()->add('checkcode', Lang::get("profile.invalid-code-value")); } }); return $validator; }
/** * Extends this method to initialize some vars. * * @return \Illuminate\Contracts\Validation\Validator */ protected function getValidatorInstance() { $this->init(); return parent::getValidatorInstance(); }