22
33namespace RahulHaque \Filepond ;
44
5- use Illuminate \Http \File ;
65use Illuminate \Support \Facades \Storage ;
76use RahulHaque \Filepond \Models \Filepond as FilepondModel ;
87
@@ -27,7 +26,7 @@ public function field(string|array|null $field, bool $checkOwnership = true)
2726 /**
2827 * Return file object from the field
2928 *
30- * @return array| \Illuminate\Http\UploadedFile
29+ * @return \Illuminate\Http\UploadedFile|array<int, \Illuminate\Http\UploadedFile>|null
3130 */
3231 public function getFile ()
3332 {
@@ -48,7 +47,7 @@ public function getFile()
4847 * Get the filepond file as Data URL string
4948 * More at - https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs
5049 *
51- * @return array|string
50+ * @return array|array<int, string>|null
5251 *
5352 * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
5453 */
@@ -80,7 +79,25 @@ public function getModel()
8079 /**
8180 * Copy the FilePond files to destination
8281 *
83- * @return array
82+ * @return array{
83+ * id: int,
84+ * dirname: string,
85+ * basename: string,
86+ * extension: string,
87+ * mimetype: string,
88+ * filename: string,
89+ * location: string,
90+ * url: string
91+ * }|array<int, array{
92+ * id: int,
93+ * dirname: string,
94+ * basename: string,
95+ * extension: string,
96+ * mimetype: string,
97+ * filename: string,
98+ * location: string,
99+ * url: string
100+ * }>|null
84101 *
85102 * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
86103 */
@@ -109,7 +126,25 @@ public function copyTo(string $path, string $disk = '', string $visibility = '')
109126 /**
110127 * Copy the FilePond files to destination and delete
111128 *
112- * @return array
129+ * @return array{
130+ * id: int,
131+ * dirname: string,
132+ * basename: string,
133+ * extension: string,
134+ * mimetype: string,
135+ * filename: string,
136+ * location: string,
137+ * url: string
138+ * }|array<int, array{
139+ * id: int,
140+ * dirname: string,
141+ * basename: string,
142+ * extension: string,
143+ * mimetype: string,
144+ * filename: string,
145+ * location: string,
146+ * url: string
147+ * }>|null
113148 *
114149 * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
115150 */
@@ -146,7 +181,7 @@ public function moveTo(string $path, string $disk = '', string $visibility = '')
146181 public function delete ()
147182 {
148183 if (! $ this ->getFieldValue ()) {
149- return null ;
184+ return ;
150185 }
151186
152187 if ($ this ->getIsMultipleUpload ()) {
@@ -175,7 +210,16 @@ public function delete()
175210 /**
176211 * Put the file in permanent storage and return response
177212 *
178- * @return array
213+ * @return array{
214+ * id: int,
215+ * dirname: string,
216+ * basename: string,
217+ * extension: string,
218+ * mimetype: string,
219+ * filename: string,
220+ * location: string,
221+ * url: string
222+ * }
179223 *
180224 * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
181225 */
@@ -188,7 +232,7 @@ private function putFile(FilepondModel $filepond, string $path, string $disk, st
188232 Storage::disk ($ permanentDisk )->writeStream (
189233 $ pathInfo ['dirname ' ].DIRECTORY_SEPARATOR .$ pathInfo ['filename ' ].'. ' .$ filepond ->extension ,
190234 Storage::disk ($ this ->getTempDisk ())->readStream ($ filepond ->filepath ),
191- $ visibility !== '' ? ['visibility ' => $ visibility ] : [],
235+ $ visibility !== '' ? ['visibility ' => $ visibility ] : []
192236 );
193237
194238 return [
0 commit comments