Attachment
class Attachment
Traits
Properties
| static protected array | $macros | The registered string macros. |
from Macroable |
| string|null | $as | The attached file's filename. |
|
| string|null | $mime | The attached file's mime type. |
Methods
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Create a mail attachment from a path.
Create a mail attachment from a URL.
Create a mail attachment from a file in the default storage disk.
Create a mail attachment from a file in the specified storage disk.
Get a storage disk instance.
Set the attached file's filename.
Set the attached file's mime type.
Attach the attachment with the given strategies.
Attach the attachment to a built-in mail type.
Determine if the given attachment is equivalent to this attachment.
Flush all static state.
Details
in
Macroable at line 28
static void
macro(string $name, callable|object $macro)
Register a custom macro.
Boot-only. Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.
in
Macroable at line 41
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
Boot-only. Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.
in
Macroable at line 57
static bool
hasMacro(string $name)
Check if macro is registered.
in
Macroable at line 68
static void
flushMacros()
Flush the existing macros.
Boot or tests only. Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.
in
Macroable at line 78
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
in
Macroable at line 103
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
at line 45
static Attachment
fromPath(string $path)
Create a mail attachment from a path.
at line 53
static Attachment
fromUrl(string $url)
Create a mail attachment from a URL.
at line 61
static Attachment
fromData(Closure $data, string|null $name = null)
Create a mail attachment from in-memory data.
at line 71
static Attachment
fromUploadedFile(UploadedFile $file)
Create a mail attachment from an UploadedFile instance.
at line 85
static Attachment
fromStorage(string $path)
Create a mail attachment from a file in the default storage disk.
at line 93
static Attachment
fromStorageDisk(string|null $disk, string $path)
Create a mail attachment from a file in the specified storage disk.
at line 110
static protected Filesystem
getStorageDisk(string|null $disk)
Get a storage disk instance.
at line 120
Attachment
as(string|null $name)
Set the attached file's filename.
at line 130
Attachment
withMime(string $mime)
Set the attached file's mime type.
at line 140
mixed
attachWith(Closure $pathStrategy, Closure $dataStrategy)
Attach the attachment with the given strategies.
at line 150
mixed
attachTo(Mailable|MailMessage|Message $mail, array $options = [])
Attach the attachment to a built-in mail type.
at line 176
bool
isEquivalent(Attachment $attachment, array $options = [])
Determine if the given attachment is equivalent to this attachment.
at line 193
static void
flushState()
Flush all static state.