demo/app/Modules/Torrent/Tasks/UpdateTask.php
2023-03-23 18:50:47 +01:00

23 lines
501 B
PHP

<?php
namespace LaraBB\Torrent\Tasks;
use LaraBB\Torrent\Models\Torrent;
class UpdateTask
{
/**
* @param Torrent $torrent
* @param array $data
* @return bool
*/
public function run(Torrent $torrent, array $data): bool
{
$torrent->leecher = $data['leecher'] ?? $torrent->leecher;
$torrent->seeder = $data['seeder'] ?? $torrent->seeder;
$torrent->finished = $data['finished'] ?? $torrent->finished;
return $torrent->save();
}
}