2
votes

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('/');

        }

    }


}
2
This is syntax error in PHP language. Nothing common neither with Laravel nor with its validation.Rolice

2 Answers

4
votes

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);
0
votes

Missing semicolon in log::error($validator)