title: GroupBy Query Laravel 5.1
body: <p>I'm having problem in fetching the data using groupBy, I don't where I'm wrong, I have done it many times before, but today I'm wrong some where and I don't know where. Following is the Table from which I want to select the Data:</p>
  
  <p>Table Name: <strong>user_questions</strong></p>
  
  <pre><code>id | user_id | message | read_status_user | read_status_support | answered
  </code></pre>
  
  <p>Now suppose if one user sends more than one messages, then user_id will be repeated, So to want all the message from one particular user I'm firing the query like following: </p>
  
  <pre><code>UserQuestion::groupBy('user_id')-&gt;get();
  </code></pre>
  
  <p>This should give me the result like</p>
  
  <pre><code>user_id = 1 &gt; message1
  user_id = 1 &gt; message2
  ....
  user_id = 1 &gt; message...(if any)
  
  user_id = 2 &gt; message1
  user_id = 2 &gt; message2
  ..... 
  So on...
  </code></pre>
  
  <p>But this is always giving me only one message from the particular user. I don't know why. Is there any mistake? I have tried another queries too, but all are giving me the same result.</p>
  
  <p>Please help me with this. Everybody's help will be highly appreciated. Thanks to all of you in advance.</p>