| Conditions | 5 |
| Paths | 4 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 30 |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | public function remove($id) |
||
| 31 | { |
||
| 32 | if (! $id) { |
||
| 33 | return false; |
||
| 34 | } |
||
| 35 | $asset = Asset::find($id)->first(); |
||
| 36 | $media = $asset->media; |
||
| 37 | foreach ($media as $file) { |
||
| 38 | if (! is_file(public_path($file->getUrl())) || ! is_writable(public_path($file->getUrl()))) { |
||
| 39 | throw new FileNotAccessibleException(); |
||
| 40 | } |
||
| 41 | } |
||
| 42 | $asset->delete(); |
||
| 43 | } |
||
| 55 |