fixed the config forms not working (controler needed update)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user