Merge pull request #2190 from dmeltzer/fix-asset-creation

Flash input on model validation errors when creating/editing assets.
This commit is contained in:
snipe 2016-06-22 12:23:13 -07:00 committed by GitHub
commit 70aefdc9c0

View file

@ -254,6 +254,7 @@ class AssetsController extends Controller
\Session::flash('success', trans('admin/hardware/message.create.success')); \Session::flash('success', trans('admin/hardware/message.create.success'));
return response()->json(['redirect_url' => route('hardware')]); return response()->json(['redirect_url' => route('hardware')]);
} }
\Input::flash();
\Session::flash('errors', $asset->getErrors()); \Session::flash('errors', $asset->getErrors());
return response()->json(['errors' => $asset->getErrors()], 500); return response()->json(['errors' => $asset->getErrors()], 500);
} }
@ -417,6 +418,7 @@ class AssetsController extends Controller
\Session::flash('success', trans('admin/hardware/message.update.success')); \Session::flash('success', trans('admin/hardware/message.update.success'));
return response()->json(['redirect_url' => route("view/hardware", $assetId)]); return response()->json(['redirect_url' => route("view/hardware", $assetId)]);
} }
\Input::flash();
\Session::flash('errors', $asset->getErrors()); \Session::flash('errors', $asset->getErrors());
return response()->json(['errors' => $asset->getErrors()], 500); return response()->json(['errors' => $asset->getErrors()], 500);