I am using spectacular Laravel Framework but i have a validation issue that i cannot solve in any way trying to validate a single email field.
My form input is:
{{ Form::email('email', Input::old('email'), array('id' => 'email', 'class' => 'span4', 'placeholder' => Lang::line('newsletter.email')->get($lang), 'novalidate' => 'novalidate')) }}
My controller
public function post_newsletter() {
$email = Input::get('email');
$v = Newsletter::validator($email, Newsletter::$rules);
if($v !== true)
{ ... }
else
{ ... }
}
and my model
class Newsletter extends Eloquent {
/**
* Newsletter validation rules
*/
public static $rules = array(
'email' => 'required|email|unique:newsletters'
);
/**
* Input validation
*/
public static function validator($attributes, $rules) {
$v = Validator::make($attributes, $rules);
return $v->fails() ? $v : true;
}
}
I ve done this so many times with success with much complicated forms but now even if i enter a valid email i get an error message about required fied etc Am I missing something? Maybe is the fact that i try to validate just one single field? I really don't get it why this happens.
Validator
object after running the validation. – Jason Lewis May 9 at 0:56