first commit
Some checks failed
Build / run (push) Has been cancelled

This commit is contained in:
maher
2025-10-29 11:42:25 +01:00
commit 703f50a09d
4595 changed files with 385164 additions and 0 deletions

56
common/Files/FileDownloader.php Executable file
View File

@@ -0,0 +1,56 @@
<?php namespace Common\Files;
use GuzzleHttp\Client;
use Illuminate\Filesystem\FilesystemAdapter;
use Illuminate\Filesystem\FilesystemManager;
class FileDownloader {
/**
* Upload model.
*
* @var FileEntry
*/
private $upload;
/**
* Http client instance.
*
* @var Client
*/
private $http;
/**
* Laravel Storage service instance.
*
* @var FilesystemAdapter
*/
private $laravelStorage;
/**
* Storage constructor.
*
* @param FileEntry $upload
* @param Client $http
* @param FilesystemManager $laravelStorage
*/
public function __construct(FileEntry $upload, Client $http, FilesystemManager $laravelStorage)
{
$this->upload = $upload;
$this->http = $http;
$this->laravelStorage = $laravelStorage;
}
/**
* Download file from specified remote url.
*
* @param string $url
* @param array $params
*
* @return string
*/
public function downloadRemoteFile($url, $params = [])
{
return $this->http->request('GET', $url, $params)->getBody()->getContents();
}
}