1 | <?php |
||
11 | class Filesystem |
||
12 | { |
||
13 | /** |
||
14 | * @var \Illuminate\Contracts\Filesystem\Factory |
||
15 | */ |
||
16 | protected $filesystem; |
||
17 | |||
18 | /** |
||
19 | * @var \Illuminate\Contracts\Config\Repository |
||
20 | */ |
||
21 | protected $config; |
||
22 | |||
23 | /** |
||
24 | * @var array |
||
25 | */ |
||
26 | protected $customRemoteHeaders = []; |
||
27 | |||
28 | /** |
||
29 | * @param \Illuminate\Contracts\Filesystem\Factory $filesystems |
||
30 | * @param \Illuminate\Contracts\Config\Repository $config |
||
31 | */ |
||
32 | public function __construct(Factory $filesystems, ConfigRepository $config) |
||
37 | |||
38 | /* |
||
39 | * Add a file to the mediaLibrary for the given media. |
||
40 | */ |
||
41 | public function add(string $file, Media $media, string $targetFileName = '') |
||
49 | |||
50 | /* |
||
51 | * Copy a file to the medialibrary for the given $media. |
||
52 | */ |
||
53 | public function copyToMediaLibrary(string $file, Media $media, bool $conversions = false, string $targetFileName = '') |
||
71 | |||
72 | /** |
||
73 | * Add custom remote headers on runtime. |
||
74 | * |
||
75 | * @param array $customRemoteHeaders |
||
76 | */ |
||
77 | public function addCustomRemoteHeaders(array $customRemoteHeaders) |
||
78 | { |
||
79 | $this->customRemoteHeaders = $customRemoteHeaders; |
||
80 | } |
||
81 | |||
82 | /* |
||
83 | * Get the headers to be used when copying the |
||
84 | * given file to a remote filesytem. |
||
85 | */ |
||
86 | public function getRemoteHeadersForFile(string $file) : array |
||
94 | |||
95 | /* |
||
96 | * Copy a file from the medialibrary to the given targetFile. |
||
97 | */ |
||
98 | public function copyFromMediaLibrary(Media $media, string $targetFile) |
||
108 | |||
109 | /* |
||
110 | * Remove all files for the given media. |
||
111 | */ |
||
112 | public function removeFiles(Media $media) |
||
123 | |||
124 | /* |
||
125 | * Rename a file for the given media. |
||
126 | */ |
||
127 | public function renameFile(Media $media, string $oldName) |
||
134 | |||
135 | /* |
||
136 | * Return the directory where all files of the given media are stored. |
||
137 | */ |
||
138 | public function getMediaDirectory(Media $media, bool $conversion = false) : string |
||
150 | |||
151 | /* |
||
152 | * Return the directory where all conversions of the given media are stored. |
||
153 | */ |
||
154 | public function getConversionDirectory(Media $media) : string |
||
158 | } |
||
159 |