From 560115e758ea0ac2c9ad8cf3ae21f8e0451868fb Mon Sep 17 00:00:00 2001 From: Daniel Meltzer Date: Wed, 22 Jun 2016 10:02:29 -0400 Subject: [PATCH] If we survive form request validation but fail model validation, ensure that the errors are actually flashed to the session. Another thing that will be better fixed in the future when handling json nicer. --- app/Http/Controllers/AssetsController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/AssetsController.php b/app/Http/Controllers/AssetsController.php index 365c93d6fe..60826ff86f 100755 --- a/app/Http/Controllers/AssetsController.php +++ b/app/Http/Controllers/AssetsController.php @@ -254,8 +254,8 @@ class AssetsController extends Controller \Session::flash('success', trans('admin/hardware/message.create.success')); return response()->json(['redirect_url' => route('hardware')]); } - - return response()->json(['errors' => $asset->getErrors()]); + \Session::flash('errors', $asset->getErrors()); + return response()->json(['errors' => $asset->getErrors()], 500); } /**