Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
DocumentManager | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
put | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
6 |
1 | <?php |
2 | |
3 | namespace App\Http\Helpers\FileManagement\S3; |
4 | |
5 | use Illuminate\Support\Facades\Validator; |
6 | |
7 | class DocumentManager extends FileManager |
8 | { |
9 | private $maxSize = 5000000; |
10 | |
11 | public function put($file, $public = true, $base64 = false) |
12 | { |
13 | // if ($base64 && $file->getSize() <= $this->maxSize) { |
14 | // return parent::upload($file, $public); |
15 | // } |
16 | |
17 | $validator = Validator::make( |
18 | ['file' => $file], |
19 | ['file' => 'required|doc|mimes:txt,pdf,doc,docx,xsl,xslx'] |
20 | ); |
21 | |
22 | if ($validator->fails()) { |
23 | return [ |
24 | 'error' => 'The given data was invalid.', |
25 | 'error_list' => $validator->errors()->all(), |
26 | ]; |
27 | } |
28 | |
29 | return parent::upload($file, $public); |
30 | } |
31 | } |