1 | <?php |
||
2 | |||
3 | namespace Ikechukwukalu\Clamavfileupload\Support; |
||
4 | |||
5 | use Ikechukwukalu\Clamavfileupload\Foundation\FileUpload; |
||
6 | use Ikechukwukalu\Clamavfileupload\Models\FileUpload as FileUploadModel; |
||
7 | use Illuminate\Database\Eloquent\Collection as EloquentCollection; |
||
8 | |||
9 | class BasicFileUpload extends FileUpload |
||
10 | { |
||
11 | |||
12 | /** |
||
13 | * Run files scan and upload. |
||
14 | * |
||
15 | * @return \Ikechukwukalu\Clamavfileupload\Models\FileUpload |
||
16 | * @return \Illuminate\Database\Eloquent\Collection |
||
17 | * @return bool |
||
18 | */ |
||
19 | public function fileUpload(): bool|FileUploadModel|EloquentCollection |
||
20 | { |
||
21 | if($this->request->file()) { |
||
22 | if (!$this->storeFiles()) { |
||
23 | return $this->failedUpload(trans('clamavfileupload::clamav.failed')); |
||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() |
|||
24 | } |
||
25 | |||
26 | if (is_array($this->request->file($this->input))) { |
||
27 | return $this->insertMultipleFiles(); |
||
0 ignored issues
–
show
|
|||
28 | } |
||
29 | |||
30 | return $this->insertSingleFile(); |
||
0 ignored issues
–
show
|
|||
31 | } |
||
32 | |||
33 | $this->failedUpload(trans('clamavfileupload::clamav.empty_file_input')); |
||
34 | return false; |
||
0 ignored issues
–
show
|
|||
35 | } |
||
36 | } |
||
37 |