Total Complexity | 5 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Coverage | 78.95% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | class KillFileLink extends FilesDomain |
||
16 | { |
||
17 | protected $linkID; |
||
18 | |||
19 | // Only disable the link by adjusting the expire date |
||
20 | 2 | public function disableLink($linkID) |
|
21 | { |
||
22 | 2 | $linkData = FileLinks::findOrFail($linkID)->update([ |
|
23 | 2 | 'expire' => Carbon::yesterday() |
|
24 | ]); |
||
25 | |||
26 | 2 | Log::info('File Link has been disabled by '.Auth::user()->full_name.'. Link Data - ', array($linkData)); |
|
27 | 2 | return true; |
|
28 | } |
||
29 | |||
30 | // Delete the file link and all attached files |
||
31 | 2 | public function deleteFileLink($linkID) |
|
32 | { |
||
33 | 2 | $linkData = FileLinks::findOrFail($linkID); |
|
34 | |||
35 | 2 | $this->removeLinkFiles(); |
|
36 | 2 | Log::notice('File Link has been deleted by '.Auth::user()->full_name.'. Link Data - ', array($linkData)); |
|
37 | 2 | $linkData->delete(); |
|
38 | |||
39 | 2 | return true; |
|
40 | } |
||
41 | |||
42 | // Remove all of the files attached to the link |
||
43 | 2 | protected function removeLinkFiles() |
|
56 | } |
||
57 | } |
||
58 | 2 | } |
|
60 |