Skip to content

Commit 0d3827c

Browse files
committed
create new method downloadFileFromStorage for attachment model
1 parent e052170 commit 0d3827c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Models/MailAttachment.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,14 @@ public function getFileDataAttribute(): string
6464
{
6565
return Storage::disk($this->disk)->get($this->storagePath);
6666
}
67+
68+
public function downloadFileFromStorage(?string $filename = null): string
69+
{
70+
return Storage::disk($this->disk)
71+
->download(
72+
$this->storagePath,
73+
$filename ?? $this->filename, [
74+
'Content-Type' => $this->mime,
75+
]);
76+
}
6777
}

0 commit comments

Comments
 (0)