A free open source IT asset/license management system
Added better form request handling
snipefddcc0fefd73
diff --git a/app/Http/Requests/Request.php b/app/Http/Requests/Request.phpindex 618c9f30f9..7ab4fc16b2 100644--- a/app/Http/Requests/Request.php+++ b/app/Http/Requests/Request.php@@ -1,6 +1,7 @@<?phpnamespace App\Http\Requests;+use App\Helpers\Helper;use Illuminate\Foundation\Http\FormRequest;@@ -13,9 +14,15 @@ abstract class Request extends FormRequestreturn $this->rules;}- // public function response(array $errors)- // {- // $this->session->flash('errorMessages', $errors);- // return $this->redirector->back()->withErrors($errors)->withInput();- // }+ public function response(array $errors)+ {+ if ($this->ajax() || $this->wantsJson())+ {+ return Helper::formatStandardApiResponse('error', null, $errors);+ }++ return $this->redirector->to($this->getRedirectUrl())+ ->withInput($this->except($this->dontFlash))+ ->withErrors($errors, $this->errorBag);+ }}