Attachment
class Attachment extends Attachment (View source)
Traits
Properties
| static protected array | $macros | The registered string macros. |
from Macroable |
| string|null | $as | The attached file's filename. |
from Attachment |
| string|null | $mime | The attached file's mime type. |
from Attachment |
| protected Closure | $resolver | A callback that attaches the attachment to the mail message. |
from Attachment |
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 file in the default storage disk.
Create a mail attachment from a file in the specified storage disk.
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.
Laravel Cloud is the best place to deploy Laravel, Nuxt, Express, Hono, Node.js, Bun, Go, Flask, Python, and more, with dedicated infrastructure available on AWS through Laravel Private Cloud.