fixed the config forms not working (controler needed update)

This commit is contained in:
2018-07-26 22:24:39 +02:00
parent 2e075799f2
commit a71fed254a
7 changed files with 63 additions and 24 deletions
+17
View File
@@ -5,6 +5,7 @@ namespace App\Exceptions;
use Exception;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Validation\ValidationException;
class Handler extends ExceptionHandler
{
@@ -63,4 +64,20 @@ class Handler extends ExceptionHandler
? response()->json(['message' => $exception->getMessage()], 401)
: redirect()->guest(route('login'));
}
/**
* Convert a validation exception into a response.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Validation\ValidationException $exception
* @return \Illuminate\Http\Response
*/
protected function invalid($request, ValidationException $exception)
{
flash()->error("Some form fields were not filled correctly.");
return redirect($exception->redirectTo ?? url()->previous())
->withInput($request->except($this->dontFlash))
->withErrors($exception->errors(), $exception->errorBag);
}
}