[admin] set torrent pos_state_until

This commit is contained in:
xiaomlove
2022-09-18 03:33:13 +08:00
parent 29fc44e555
commit 464880f1fb
3 changed files with 34 additions and 9 deletions
@@ -155,13 +155,17 @@ class TorrentResource extends Resource
->label(__('label.torrent.pos_state'))
->options(Torrent::listPosStates(true))
->required()
,
Forms\Components\DateTimePicker::make('pos_state_until')
->label(__('label.deadline'))
,
])
->icon('heroicon-o-arrow-circle-up')
->action(function (Collection $records, array $data) {
$idArr = $records->pluck('id')->toArray();
try {
$torrentRep = new TorrentRepository();
$torrentRep->setPosState($idArr, $data['pos_state']);
$torrentRep->setPosState($idArr, $data['pos_state'], $data['pos_state_until']);
} catch (\Exception $exception) {
do_log($exception->getMessage() . $exception->getTraceAsString(), 'error');
Filament::notify('danger', class_basename($exception));