meilisearch return search_box_id

This commit is contained in:
xiaomlove
2023-04-07 02:19:28 +08:00
parent 3dff8e457d
commit fe49b6a2ba
3 changed files with 25 additions and 4 deletions

View File

@@ -8,6 +8,7 @@ use App\Models\Category;
use App\Models\Icon;
use App\Models\NexusModel;
use App\Models\SearchBox;
use App\Models\Torrent;
use App\Repositories\SearchBoxRepository;
use Filament\Facades\Filament;
use Filament\Forms;
@@ -46,7 +47,19 @@ class CategoryResource extends Resource
Forms\Components\Select::make('mode')
->options(SearchBox::listModeOptions())
->label(__('label.search_box.label'))
->required()
->rules([
'required',
function () {
return function ($attribute, $value, $fail) {
//@todo how to get the editing record ?
$exists = Torrent::query()->where('category', $value)->exists();
do_log("check $attribute: $value torrent if exists: $exists");
// if ($exists) {
// $fail("There are torrents belonging to this category that cannot be changed!");
// }
};
}
])
,
Forms\Components\TextInput::make('name')->required()->label(__('label.search_box.taxonomy.name'))->required(),
Forms\Components\TextInput::make('image')