46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace LaraBB\Peer\Tasks;
|
|
|
|
use LaraBB\Peer\Models\Peer;
|
|
|
|
/**
|
|
*
|
|
*/
|
|
class StoreTask
|
|
{
|
|
|
|
/**
|
|
* @param Peer $peer
|
|
*/
|
|
public function __construct(private readonly Peer $peer)
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @param array $data
|
|
* @return bool|Peer
|
|
*/
|
|
public function run(array $data): bool|Peer
|
|
{
|
|
$this->peer->created_uuid = $data['created_uuid'];
|
|
$this->peer->updated_uuid = $data['updated_uuid'];
|
|
$this->peer->torrent_uuid = $data['torrent_uuid'];
|
|
$this->peer->peer_id = $data['peer_id'];
|
|
$this->peer->ip = $data['ip'];
|
|
$this->peer->port = $data['port'];
|
|
$this->peer->status = $data['status'];
|
|
$this->peer->natuser = $data['natuser'];
|
|
$this->peer->client = $data['client'];
|
|
$this->peer->dns = $data['dns'];
|
|
$this->peer->uploaded = $data['uploaded'];
|
|
$this->peer->downloaded = $data['downloaded'];
|
|
|
|
if($this->peer->save()) {
|
|
return $this->peer;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|