Viewing file: MessageSent.php (1.67 KB) -rwxrwxr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
namespace Illuminate\Mail\Events;
use Symfony\Component\Mime\Email;
class MessageSent { /** * The Symfony Email instance. * * @var \Symfony\Component\Mime\Email */ public $message;
/** * The message data. * * @var array */ public $data;
/** * Create a new event instance. * * @param \Symfony\Component\Mime\Email $message * @param array $data * @return void */ public function __construct(Email $message, array $data = []) { $this->data = $data; $this->message = $message; }
/** * Get the serializable representation of the object. * * @return array */ public function __serialize() { $hasAttachments = collect($this->message->getAttachments())->isNotEmpty();
return $hasAttachments ? [ 'message' => base64_encode(serialize($this->message)), 'data' => base64_encode(serialize($this->data)), 'hasAttachments' => true, ] : [ 'message' => $this->message, 'data' => $this->data, 'hasAttachments' => false, ]; }
/** * Marshal the object from its serialized data. * * @param array $data * @return void */ public function __unserialize(array $data) { if (isset($data['hasAttachments']) && $data['hasAttachments'] === true) { $this->message = unserialize(base64_decode($data['message'])); $this->data = unserialize(base64_decode($data['data'])); } else { $this->message = $data['message']; $this->data = $data['data']; } } }
|