diff --git a/src/Components/Modals/CuratorPanel.php b/src/Components/Modals/CuratorPanel.php index e5964df..7772572 100644 --- a/src/Components/Modals/CuratorPanel.php +++ b/src/Components/Modals/CuratorPanel.php @@ -305,16 +305,18 @@ public function removeFromFiles(int | string $id): void public function updatedSearch(): void { + $flexibleSearch = str_replace([' ', '-', '_'], '%', $this->search); + $this->files = $this->mediaClass ->query() ->when($this->isLimitedToDirectory, function ($query) { return $query->where('directory', $this->directory); }) - ->where('name', 'like', '%' . $this->search . '%') - ->orWhere('title', 'like', '%' . $this->search . '%') - ->orWhere('alt', 'like', '%' . $this->search . '%') - ->orWhere('caption', 'like', '%' . $this->search . '%') - ->orWhere('description', 'like', '%' . $this->search . '%') + ->where('name', 'like', '%' . $flexibleSearch . '%') + ->orWhere('title', 'like', '%' . $flexibleSearch . '%') + ->orWhere('alt', 'like', '%' . $flexibleSearch . '%') + ->orWhere('caption', 'like', '%' . $flexibleSearch . '%') + ->orWhere('description', 'like', '%' . $flexibleSearch . '%') ->limit(50) ->get() ->toArray();