Take the 2-minute tour ×

I seem to be having an issue with eloquent's validator method returning the opposite of what it should.

Here is my validation call, and it should fail as email is a duplicate and first name is only 1 char, when minimum required is 2.

// Handle the submission of changed user details.
public function put_settings()
    $id = Input::get('id');

    $validation = Account::validate(Input::all());

        return Redirect::to_route('settings')->with_errors($validation)->with_input();
        Account::update($id, array(
            'first_name' => Input::get('first_name'),
            'last_name'  => Input::get('last_name'),
            'email'      => Input::get('email')

        return Redirect::to_route('settings');

Here is my validator method with validation rules (located in my model):

public static function validate($data)
    $rules = array(
        'first_name' => 'required|min:2|max:80',
        'last_name'  => 'required|min:2|max:80',
        'email'      => 'required|min:5|max:180|unique:users',

    return Validator::make($data, $rules);

Why is this updating my database, even though it fails on validation. Tried with both the fails() and passes() methods and they seem to be doing the opposite of what they should be. Any idea's?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Have you tried debugging out the inputs and see what's actually submitted?

Also, you might want to check auth.php to see if you have selected 'email' to be considered as your username for your users. That way if you call 'unique:users', laravel will look at email column instead of username column.

share|improve this answer
add comment

Your Answer


