title: Sending a mailable with binary data
body: <p>I'm trying to queue a mailable containing a property with a model (<code>Order</code>) that has a binary id.</p>
  
  <pre><code>&lt;?php
  
  namespace App\Mail;
  
  use App\Order;
  use Illuminate\Bus\Queueable;
  use Illuminate\Mail\Mailable;
  use Illuminate\Queue\SerializesModels;
  
  class OrderShipped extends Mailable
  {
      use Queueable, SerializesModels;
  
      /**
       * The order instance.
       *
       * @var Order
       */
      public $order;
  
      /**
       * Create a new message instance.
       *
       * @return void
       */
      public function __construct(Order $order)
      {
          $this-&gt;order = $order;
      }
  
      /**
       * Build the message.
       *
       * @return $this
       */
      public function build()
      {
          return $this-&gt;view('emails.orders.shipped');
      }
  }
  </code></pre>
  
  <p>The <code>Order</code> implements the <a href="http://php.net/manual/en/class.serializable.php" rel="nofollow noreferrer"><code>Serializable</code></a> interface. In the <code>serialize</code>method of the model I'm converting the binary id to a string, so it can be properly encoded to json.</p>
  
  <p>Unfortunately the <code>serialize</code>method is never called when I want to queue the mail.</p>
  
  <p>Is this a bug in the framework or am I missing something?</p>
  
  <p>Also I noticed in the PHP docs that, when using the <code>Serializable</code>interface, the <code>__sleep</code>and <code>__wakeup</code>methods are no longer supported:</p>
  
  <blockquote>
    <p>Classes that implement this interface no longer support __sleep() and
    __wakeup().</p>
  </blockquote>
  
  <p>But the <code>Illuminate\Queue\SerializesModels</code> trait seems to override them...</p>
  
  <p><strong>EDIT</strong>
  I'm using <a href="https://github.com/alsofronie/eloquent-uuid/blob/master/src/UuidBinaryModelTrait.php" rel="nofollow noreferrer">this trait for my binary ids</a>.
  In my <code>serialize</code> method I simply call <code>$this-&gt;toArray()</code>.</p>