From dab058179c739b4f99aa573e2a81675e575b7749 Mon Sep 17 00:00:00 2001 From: Duncan McClean Date: Thu, 24 Oct 2024 16:46:15 +0100 Subject: [PATCH] wip --- resources/js/components/Mappings.vue | 6 +++++- src/Http/Requests/UpdateImportRequest.php | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/resources/js/components/Mappings.vue b/resources/js/components/Mappings.vue index 1c9f0cc..93e9f1d 100644 --- a/resources/js/components/Mappings.vue +++ b/resources/js/components/Mappings.vue @@ -7,7 +7,7 @@

{{ __('Configuration') }}

-

{{ __('You can add or modify your Blueprint fields to customize what data is imported and what fieldtype it will be stored in. You can save, refresh, and com back to this import config later until it\'s ready to run.') }}

+

{{ __('You can add or modify your Blueprint fields to customize what data is imported and what fieldtype it will be stored in. You can save, refresh, and come back to this import config later until it\'s ready to run.') }}

@@ -57,6 +57,10 @@ +
+ +
+
diff --git a/src/Http/Requests/UpdateImportRequest.php b/src/Http/Requests/UpdateImportRequest.php index d78e7d8..edbd57e 100644 --- a/src/Http/Requests/UpdateImportRequest.php +++ b/src/Http/Requests/UpdateImportRequest.php @@ -15,7 +15,11 @@ public function rules(): array { return [ 'run' => ['nullable', 'boolean'], - 'mappings' => ['required', 'array'], + 'mappings' => ['required', 'array', function ($attribute, $value, $fail) { + if (collect($value)->reject(fn (array $mapping) => empty($mapping['key']))->isEmpty()) { + $fail('You must map at least one field.')->translate(); + } + }], 'mappings.*.key' => ['nullable', 'string'], 'unique_field' => ['required', 'string'], ];