connection->transaction(function() use($request) { $this->torrent = $this->storeTorrentTask->run($this->prepareTorrentData($request)); }); } catch (Throwable $t) { return false; } return $this->torrent; } /** * @param $request * @return array */ private function prepareTorrentData($request): array { $torrent = TorrentFile::load($request->file('torrent')); return [ 'created_uuid' => $request->user()->uuid, 'updated_uuid' => $request->user()->uuid, 'infohash' => $torrent->getInfoHash(), 'name' => $torrent->getName(), 'filename' => $request->file('torrent')->store('torrents'), 'size' => $torrent->getSize(), ]; } }