/** * Delete a comment and its attachments * * @param int $comment * @return bool */ public static function delete_comment($comment) { \User\Activity::where('action_id', '=', $comment)->delete(); $comment = static::find($comment); if (!$comment) { return false; } $issue = \Project\Issue::find($comment->issue_id); /* Delete attachments and files */ $path = \Config::get('application.upload_path') . $issue->project_id; foreach ($comment->attachments()->get() as $row) { Attachment::delete_file($path . '/' . $row->upload_token, $row->filename); $row->delete(); } $comment->delete(); return true; }