Laravel错误:Response内容必须是实现__toString()的字符串或对象,给出“boolean”

I am receiving the above error in following code and totally unable to find out real cause.

        if ($validation->fails()) {
            // if it fails...
            return Redirect::to("login")->withErrors($validation)->withInput();
        } else {
            // storing user session... if it passes...
            $username =  Input::get("username");
            Session::put("username", $username);
            return Redirect::to("/");
        }

Looks like you are authenticating users. Why not use Laravel's authentication that is offered to you out of box?

For you code, not sure if it's the chained withInput() causing the error, anyway I am strongly against chaining withErrors and withInput, for it will be problematic. A better approach is to use

Input::flash();

See the doc

Check out filters.php, make sure thar Closure return null or no returns when it passes validation.