title: Merge and Sort two Eloquent Collections?
body: <p>I've two Collections and I want merge it to one variable (of course, with ordering by one collumn - <code>created_at</code>). How Can I do that?</p>
  
  <p>My Controllers looks that:</p>
  
  <pre><code>$replies = Ticket::with('replies', 'replies.user')-&gt;find($id);
  $logs = DB::table('logs_ticket')
          -&gt;join('users', 'users.id', '=', 'mod_id')
          -&gt;where('ticket_id', '=', $id)
          -&gt;select('users.username', 'logs_ticket.created_at', 'action')
          -&gt;get();
  </code></pre>
  
  <p>My Output looks for example:</p>
  
  <p>Replies:</p>
  
  <pre><code>ID | ticket_id | username | message | created_at
  1  | 1         | somebody | asdfghj | 2014-04-12 12:12:12
  2  | 1         | somebody | qwertyi | 2014-04-14 12:11:10
  </code></pre>
  
  <p>Logs: </p>
  
  <pre><code>ID | ticket_id | username | action | created_at
  1  | 1         | somebody | close  | 2014-04-13 12:12:14
  2  | 1         | somebody |  open  | 2014-04-14 14:15:10
  </code></pre>
  
  <p>And I want something like this:</p>
  
  <pre><code>ticket_id | table | username | message | created_at
  1         |replies| somebody | asdfghj | 2014-04-12 12:12:12
  1         | logs  | somebody |  close  | 2014-04-13 12:12:14
  1         | logs  | somebody |  open   | 2014-04-14 11:15:10
  1         |replies| somebody | qwertyi | 2014-04-14 12:11:10
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>My Ticket Model looks that:</p>
  
  <pre><code>&lt;?php
  
  class Ticket extends Eloquent {
  
      protected $table = 'tickets';
  
      public function replies() {
          return $this-&gt;hasMany('TicketReply')-&gt;orderBy('ticketreplies.created_at', 'desc');
      }
  
      public function user()
      {
          return $this-&gt;belongsTo('User');
      }
  }
  ?&gt;
  </code></pre>