diff --git a/models/Record.php b/models/Record.php index 3ac9375..6cb8c3c 100644 --- a/models/Record.php +++ b/models/Record.php @@ -28,6 +28,14 @@ public function getGroupsOptions() { return $this->filterGroups(); } + public function beforeDelete() { + if ($this->files && $this->files->count() > 0) { + foreach ($this->files as $file) { + $file->delete(); + } + } + } + } ?> \ No newline at end of file