From c2a06ec828692c83fd47f33f45521d3cb1ce3853 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Thu, 27 Oct 2022 17:56:59 +0200 Subject: [PATCH 1/2] Fix tracea Egg search request --- app/Http/Controllers/Fo/EggController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Fo/EggController.php b/app/Http/Controllers/Fo/EggController.php index 34e86d9..4d26d7d 100644 --- a/app/Http/Controllers/Fo/EggController.php +++ b/app/Http/Controllers/Fo/EggController.php @@ -88,7 +88,7 @@ class EggController extends Controller collect($inuavs)->map(function ($inuav) use ($mep) { $mep->where('inuav_codes', 'LIKE', "%{$inuav}%"); }); - $mep->where('transfert_date', '<', $datePonte) + $mep = $mep->where('transfert_date', '<', $datePonte) ->orderBy('transfert_date', 'DESC')->first(); if ($mep) { From baba0fc4aa1515d2174764300c9f512816d35eb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Thu, 27 Oct 2022 18:13:45 +0200 Subject: [PATCH 2/2] Fix Cafel jobs for handling model event validation errors --- app/Jobs/CafelJobs.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/app/Jobs/CafelJobs.php b/app/Jobs/CafelJobs.php index ba269ee..03f2340 100644 --- a/app/Jobs/CafelJobs.php +++ b/app/Jobs/CafelJobs.php @@ -76,14 +76,12 @@ abstract class CafelJobs implements ShouldQueue $failed = $validator->invalid(); $this->invalidRows[] = collect($row)->put('validation_message', collect($e->errors()) ->mapWithKeys(function (array $messages, string $attribute) use ($failed) { - if (!array_key_exists($attribute, $failed)) { - throw new \RuntimeException( - "ValidationException is missing faling data for '{$attribute}'" - ); + $verifiedValue = ''; + if (array_key_exists($attribute, $failed)) { + $verifiedValue = ' Valeur vérifiée : ' . \json_encode($failed[$attribute]); } return [ - $attribute => collect($messages)->implode(', ') . - ' Valeur vérifiée : ' . \json_encode($failed[$attribute]) + $attribute => collect($messages)->implode(', ') . $verifiedValue ]; })->implode(' '))->all(); }