| Conditions | 2 |
| Paths | 2 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php namespace Modules\Media\Services; |
||
| 38 | public function store(UploadedFile $file) |
||
| 39 | { |
||
| 40 | // Save the file info to db |
||
| 41 | try { |
||
| 42 | $savedFile = $this->file->createFromFile($file); |
||
| 43 | } catch (\InvalidArgumentException $e) { |
||
| 44 | return $e->getMessage(); |
||
| 45 | } |
||
| 46 | |||
| 47 | // Move the uploaded file to files path |
||
| 48 | $file->move(public_path() . $this->config->get('asgard.media.config.files-path'), $savedFile->filename); |
||
| 49 | @chmod(public_path() . $this->config->get('asgard.media.config.files-path') . $savedFile->filename, 0666); |
||
|
|
|||
| 50 | |||
| 51 | $this->createThumbnails($savedFile); |
||
| 52 | |||
| 53 | return $savedFile; |
||
| 54 | } |
||
| 55 | |||
| 68 |
If you suppress an error, we recommend checking for the error condition explicitly: