-
-
Notifications
You must be signed in to change notification settings - Fork 767
/
Copy pathLocal.php
42 lines (34 loc) · 946 Bytes
/
Local.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
namespace App\Services\Storage;
use App\Models\Document;
use App\Repositories\FilesystemIntegration\FilesystemIntegration;
use Illuminate\Support\Facades\Storage;
class Local implements FilesystemIntegration
{
public function isEnabled()
{
return true;
}
public function upload($client_folder, $filename, $file): array
{
Storage::disk('local')->put($client_folder, $file);
return ['file_path' => $client_folder . '/' . $file->hashName()];
}
public function delete($full_path): bool
{
return Storage::disk('local')->delete($full_path);
}
public function view($file)
{
return $this->download($file);
}
public function download($file)
{
$fileData = Storage::disk('local')->get($file->path);
return $fileData;
}
public function revokeAccess()
{
// TODO: Implement revokeAccess() method.
}
}