From 74177fac153bd3f2f078eccc26c45374f64c64d8 Mon Sep 17 00:00:00 2001 From: Adam Weston Date: Thu, 4 Jan 2024 12:01:39 -0500 Subject: [PATCH] Fix: max items validation error in panel --- src/Components/Modals/CuratorPanel.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Components/Modals/CuratorPanel.php b/src/Components/Modals/CuratorPanel.php index 26e0ae37..5cb964d0 100644 --- a/src/Components/Modals/CuratorPanel.php +++ b/src/Components/Modals/CuratorPanel.php @@ -21,6 +21,7 @@ use Illuminate\Support\Arr; use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Storage; +use Illuminate\Support\Str; use Livewire\Attributes\On; use Livewire\Component; use Livewire\WithPagination; @@ -138,6 +139,12 @@ public function openModal(string $id, array $settings = []): void public function form(Form $form): Form { + if ($this->maxItems) { + $this->validationRules = array_filter($this->validationRules, function ($value) { + if ($value === 'array' || str_starts_with($value, 'max:')) { return false; } + }); + } + return $form ->schema([ Uploader::make('files_to_add')