From 815c77f9436bf2cc332aeb1e70101ac851e18886 Mon Sep 17 00:00:00 2001 From: slong753 Date: Wed, 3 May 2023 14:49:31 -0500 Subject: [PATCH] wip --- .../Assets/BulkAssetsController.php | 22 +++++++++++-------- resources/views/notifications.blade.php | 15 +++++++++++++ 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/app/Http/Controllers/Assets/BulkAssetsController.php b/app/Http/Controllers/Assets/BulkAssetsController.php index 24712da278..1e1e765ea1 100644 --- a/app/Http/Controllers/Assets/BulkAssetsController.php +++ b/app/Http/Controllers/Assets/BulkAssetsController.php @@ -223,7 +223,7 @@ class BulkAssetsController extends Controller $asset->save(); } if (!$asset->save()) { - $error_bag[] = $asset->getErrors(); + $error_bag[] = $asset->getErrors()->toArray(); } } } else { @@ -231,14 +231,18 @@ class BulkAssetsController extends Controller } } // endforeach ($assets) if(!empty($error_bag)) { - $ids = array_values($assets); - // dd($ids); - // return redirect()->back() - // ->withInput(["ids" => $ids, "bulk_actions" => "edit"]) - // ->with('error_messages', $error_bag); - // return $error_bag; - - return redirect($bulk_back_url)->with('error_messages', $error_bag); + // $errors = collect($error_bag)->unique(); + // foreach ($errors as $key => $value) { + // ray($value->message); + // } + $errors = []; + foreach ($error_bag as $key => $value) { + foreach($value as $key => $value) { + $errors[] = $value; + } + } + ray($errors); + return redirect($bulk_back_url)->with('bulk_errors', $errors); } return redirect($bulk_back_url)->with('success', trans('admin/hardware/message.update.success')); } diff --git a/resources/views/notifications.blade.php b/resources/views/notifications.blade.php index 0935c28582..4599577a1b 100755 --- a/resources/views/notifications.blade.php +++ b/resources/views/notifications.blade.php @@ -115,6 +115,21 @@ @endif +@if ($messages = Session::get('bulk_errors')) +
+
+ + + {{ trans('general.notification_error') }} + The following fields had validation errors and were not edited: + @foreach($messages as $message => $value) +
{{ $value. }} + @endforeach +
+
+@endif + + @if ($message = Session::get('warning'))