| @@ 217-231 (lines=15) @@ | ||
| 214 | ||
| 215 | $status = $this->model->delete(); |
|
| 216 | ||
| 217 | if ($status) { |
|
| 218 | $attachments->each(function (Attachment $attachment) use ($projectId) { |
|
| 219 | $path = config('filesystems.disks.local.root') |
|
| 220 | . '/' . config('tinyissue.uploads_dir') |
|
| 221 | . '/' . $projectId |
|
| 222 | . '/' . $attachment->upload_token; |
|
| 223 | $attachment->deleteFile($path, $attachment->filename); |
|
| 224 | $attachment->delete(); |
|
| 225 | }); |
|
| 226 | $comments->each(function (Project\Issue\Comment $comment) { |
|
| 227 | $comment->deleteComment($this->getLoggedUser()->user()); |
|
| 228 | }); |
|
| 229 | User\Activity::where('parent_id', '=', $projectId)->where('item_id', '=', $id)->delete(); |
|
| 230 | \DB::table('projects_issues_tags')->where('issue_id', '=', $id)->delete(); |
|
| 231 | } |
|
| 232 | ||
| 233 | return $status; |
|
| 234 | } |
|
| @@ 213-227 (lines=15) @@ | ||
| 210 | ||
| 211 | $status = parent::delete(); |
|
| 212 | ||
| 213 | if ($status) { |
|
| 214 | $attachments->each(function (Attachment $attachment) use ($projectId) { |
|
| 215 | $path = config('filesystems.disks.local.root') |
|
| 216 | . '/' . config('tinyissue.uploads_dir') |
|
| 217 | . '/' . $projectId |
|
| 218 | . '/' . $attachment->upload_token; |
|
| 219 | $attachment->deleteFile($path, $attachment->filename); |
|
| 220 | $attachment->delete(); |
|
| 221 | }); |
|
| 222 | $comments->each(function (Project\Issue\Comment $comment) { |
|
| 223 | $comment->deleteComment($this->getLoggedUser()->user()); |
|
| 224 | }); |
|
| 225 | User\Activity::where('parent_id', '=', $projectId)->where('item_id', '=', $id)->delete(); |
|
| 226 | \DB::table('projects_issues_tags')->where('issue_id', '=', $id)->delete(); |
|
| 227 | } |
|
| 228 | ||
| 229 | return $status; |
|
| 230 | } |
|