2

Stack trace: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'syntax error, unexpected '}'' in D:\xampp\htdocs\guestlara\app\controllers\LoginController.php:23

public function login_user()
{

    $rules = array(
                    'email'=> 'Required|Between:3,64|Email|Unique:users',
                    'password'=>'Required|AlphaNum|Between:4,8|Confirmed',
                    );
    $validator = Validator::make(Input::all(), $rules);

    if ($validator->fails()) {

        // get the error messages from the validator
        $messages = $validator->messages();

        // redirect our user back to the form with the errors from the validator
        return Redirect::to('/')
        ->withErrors($validator);
        log::error($validator)

    } 
    else 
    {

        // attempt to do the login
        if (Auth::attempt($users)) {

            return Redirect::to('dashboard');

        } else {        

            return Redirect::to('/');

        }

    }


}
1
  • This is syntax error in PHP language. Nothing common neither with Laravel nor with its validation. Commented Apr 6, 2016 at 7:20

2 Answers 2

4

Missing ; -

        return Redirect::to('/')
               ->withErrors($validator);
        log::error($validator); // Here

    } else {

Small change.

log::error($validator); won't be executed as the action will return before it reaches the log::error(). So it should be -

log::error($validator);
return Redirect::to('/')
       ->withErrors($validator);
Sign up to request clarification or add additional context in comments.

Comments

0

Missing semicolon in log::error($validator)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.