On this page
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
static void | macro(string $name, object|callable $macro) Register a custom macro. |
from Macroable |
static void | mixin(object $mixin, bool $replace = true) Mix another object into the class. |
from Macroable |
static bool | hasMacro(string $name) Checks if macro is registered. |
from Macroable |
static void | flushMacros() Flush the existing macros. |
from Macroable |
static mixed | __callStatic(string $method, array $parameters) Dynamically handle calls to the class. |
from Macroable |
mixed | __call(string $method, array $parameters) Dynamically handle calls to the class. |
from Macroable |
static Attachment | fromPath(string $path) Create a mail attachment from a path. |
from Attachment |
static Attachment | fromData(Closure $data, string|null $name = null) Create a mail attachment from in-memory data. |
from Attachment |
static Attachment | fromStorage(string $path) Create a mail attachment from a file in the default storage disk. |
from Attachment |
static Attachment | fromStorageDisk(string|null $disk, string $path) Create a mail attachment from a file in the specified storage disk. |
from Attachment |
$this | as(string|null $name) Set the attached file's filename. |
from Attachment |
$this | withMime(string $mime) Set the attached file's mime type. |
from Attachment |
mixed | attachWith(Closure $pathStrategy, Closure $dataStrategy) Attach the attachment with the given strategies. |
from Attachment |
mixed | attachTo(Mailable|Message|MailMessage $mail, array $options = []) Attach the attachment to a built-in mail type. |
from Attachment |
bool | isEquivalent(Attachment $attachment, array $options = []) Determine if the given attachment is equivalent to this attachment. |
from 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 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.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/10.x/Illuminate/Mail/Mailables/Attachment.html