Oct 13, 2014
0
Level 9
Where should TokenMismatchException be caught when using L5's route annotations?
This may seem a simple question, but in using the generated AuthController this is my login code:
/**
* Handle a login request to the application.
*
* @Post("auth/login", as="login")
*
* @param LoginRequest $request
* @return Response
*/
public function login(LoginRequest $request)
{
if ($this->auth->attempt($request->only('email', 'password')))
{
return redirect('/');
}
return redirect()->route('login')->withErrors([
'email' => 'These credentials do not match our records.',
]);
}
Should I add a try catch block around the if-attempt section?
Please or to participate in this conversation.