From fb680606e8b0962a6e5b6b41ebec50a4bca4c3e7 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sat, 21 May 2022 10:37:30 +1000 Subject: [PATCH] Handle no report key parameter --- app/Http/Requests/Report/GenericReportRequest.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/Http/Requests/Report/GenericReportRequest.php b/app/Http/Requests/Report/GenericReportRequest.php index c197b21d7670..208e53aac682 100644 --- a/app/Http/Requests/Report/GenericReportRequest.php +++ b/app/Http/Requests/Report/GenericReportRequest.php @@ -36,4 +36,15 @@ class GenericReportRequest extends Request 'send_email' => 'required|bool', ]; } + + public function prepareForValidation() + { + $input = $this->all(); + + + if(!array_key_exists('report_keys', $input)) + $input['report_keys'] = []; + + $this->replace($input); + } }