From a84a6fd5c8676c6d4e12f8da0f414a99f497eb4e Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Sat, 23 Sep 2023 03:04:58 +0800 Subject: [PATCH] fix torrentrss + backend torrent search --- app/Filament/Resources/Torrent/TorrentResource.php | 4 +++- include/constants.php | 4 ++-- public/torrentrss.php | 10 +++++++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/Filament/Resources/Torrent/TorrentResource.php b/app/Filament/Resources/Torrent/TorrentResource.php index bc3dc405..205d51f6 100644 --- a/app/Filament/Resources/Torrent/TorrentResource.php +++ b/app/Filament/Resources/Torrent/TorrentResource.php @@ -79,7 +79,9 @@ class TorrentResource extends Resource Tables\Columns\TextColumn::make('basic_category.name')->label(__('label.torrent.category')), Tables\Columns\TextColumn::make('name')->formatStateUsing(fn ($record) => torrent_name_for_admin($record, true)) ->label(__('label.name')) - ->searchable(), + ->searchable(query: function (Builder $query, string $search) { + return $query->where("name", "like", "%{$search}%")->orWhere("small_descr", "like", "%{$search}%"); + }), Tables\Columns\TextColumn::make('posStateText')->label(__('label.torrent.pos_state')), Tables\Columns\TextColumn::make('spStateText')->label(__('label.torrent.sp_state')), Tables\Columns\TextColumn::make('pickInfoText') diff --git a/include/constants.php b/include/constants.php index 251e8456..3d08f97a 100644 --- a/include/constants.php +++ b/include/constants.php @@ -1,6 +1,6 @@ encryptDownHash($row['id'], $user));