transactions->run(function () use ($jobId, $taskId, $imageId, $userId, $mayRemoveOthers): array { $image = $this->finder->find($jobId, $taskId, $imageId); $image->ensureRemovableBy($userId, $mayRemoveOthers); $this->images->delete($image); return $image->file()->paths(); }); $this->files->delete($paths); } }