title: Unable to unserialize queue job data
body: <p>I have this piece of code in my <code>AppServiceProvider.php</code>:</p>
  
  <pre><code>Queue::after(function (JobProcessed $event)
  {
      Log::info(unserialize($event-&gt;data['data']['command']));
  });
  </code></pre>
  
  <p>It's simply a job event that triggers when a job has successfully executed (more <a href="https://laravel.com/docs/5.2/queues" rel="nofollow noreferrer">here</a>, under "Job Events"). I got this solution from <a href="https://stackoverflow.com/a/37617100/6719559">this</a> question.</p>
  
  <p>However, the above code gives me the error:</p>
  
  <blockquote>
    <p>'ErrorException' with message 'Object of class App\Jobs\SampleJob could not be converted to string'</p>
  </blockquote>
  
  <p>Here is the output of <code>$event-&gt;data</code>:</p>
  
  <pre><code>array (
    'job' =&gt; 'Illuminate\\Queue\\CallQueuedHandler@call',
    'data' =&gt; 
    array (
      'commandName' =&gt; 'App\\Jobs\\SampleJob',
      'command' =&gt; 'O:21:"App\\Jobs\\SampleJob":5:{s:10:"' . "\0" . '*' . "\0" . 'post";O:45:"Illuminate\\Contracts\\Database\\ModelIdentifier":2:{s:5:"class";s:18:"App\\Models\\Post";s:2:"id";i:28711;}s:10:"connection";N;s:5:"queue";N;s:5:"delay";N;s:6:"' . "\0" . '*' . "\0" . 'job";N;}',
    ),
  )  
  </code></pre>
  
  <p>What am I doing wrong?</p>