| Total Complexity | 5 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Coverage | 81.25% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | class KillFileLink extends FilesDomain |
||
| 13 | { |
||
| 14 | protected $linkID; |
||
| 15 | |||
| 16 | // Only disable the link by adjusting the expire date |
||
| 17 | 2 | public function disableLink($linkID) |
|
| 18 | { |
||
| 19 | 2 | FileLinks::findOrFail($linkID)->update([ |
|
| 20 | 2 | 'expire' => Carbon::yesterday() |
|
| 21 | ]); |
||
| 22 | |||
| 23 | 2 | return true; |
|
| 24 | } |
||
| 25 | |||
| 26 | // Delete the file link and all attached files |
||
| 27 | 2 | public function deleteFileLink($linkID) |
|
| 28 | { |
||
| 29 | 2 | $linkData = FileLinks::findOrFail($linkID); |
|
| 30 | |||
| 31 | 2 | $this->removeLinkFiles(); |
|
| 32 | 2 | $linkData->delete(); |
|
| 33 | |||
| 34 | 2 | return true; |
|
| 35 | } |
||
| 36 | |||
| 37 | // Remove all of the files attached to the link |
||
| 38 | 2 | protected function removeLinkFiles() |
|
| 50 | } |
||
| 51 | } |
||
| 52 | 2 | } |
|
| 54 |