Merge pull request 'Added sftp file service' (#1032) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Reviewed-on: #1032
This commit was merged in pull request #1032.
This commit is contained in:
35
app/Services/SftpFileService.php
Normal file
35
app/Services/SftpFileService.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class SftpFileService
|
||||
{
|
||||
protected $disk;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->disk = Storage::disk('ftp');
|
||||
}
|
||||
|
||||
public function getFiles(): array
|
||||
{
|
||||
return $this->disk->files();
|
||||
}
|
||||
|
||||
public function getFileContent(string $file): string
|
||||
{
|
||||
return $this->disk->get($file);
|
||||
}
|
||||
|
||||
public function moveFile(string $file, string $destination): bool
|
||||
{
|
||||
return $this->disk->move($file, $destination);
|
||||
}
|
||||
|
||||
// public function deleteFile(string $file): bool
|
||||
// {
|
||||
// return $this->disk->delete($file);
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user