Attachment
class Attachment (View source)
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. |
|
protected Closure | $resolver | A callback that attaches the attachment to the mail message. |
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.
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.
Details
static void
macro(string $name, object|callable $macro)
Register a custom macro.
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
static bool
hasMacro(string $name)
Checks if macro is registered.
static void
flushMacros()
Flush the existing macros.
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
static Attachment
fromPath(string $path)
Create a mail attachment from a path.
static Attachment
fromUrl(string $url)
Create a mail attachment from a URL.
static Attachment
fromData(Closure $data, string|null $name = null)
Create a mail attachment from in-memory data.
static Attachment
fromStorage(string $path)
Create a mail attachment from a file in the default storage disk.
static Attachment
fromStorageDisk(string|null $disk, string $path)
Create a mail attachment from a file in the specified storage disk.
$this
as(string|null $name)
Set the attached file's filename.
$this
withMime(string $mime)
Set the attached file's mime type.
mixed
attachWith(Closure $pathStrategy, Closure $dataStrategy)
Attach the attachment with the given strategies.
mixed
attachTo(Mailable|Message|MailMessage $mail, array $options = [])
Attach the attachment to a built-in mail type.
bool
isEquivalent(Attachment $attachment, array $options = [])
Determine if the given attachment is equivalent to this attachment.