title: laravel groupby with array
body: <p>i have post with category</p>
  
  <pre><code> $response=Post::groupBy('post_category','id')-&gt;get();
  </code></pre>
  
  <p>The above query will return all posts with category in the order of category.</p>
  
  <p>Now i need to group all post inside category. Now i have one possible solution is i need to loop response and inside loop i have to check for category and create array.
  Is there a option to make it in a query something like <code>groupconcat</code>.?</p>
  
  <p>My question is: <strong>Is it possible to create an array of category so key of an array is <code>category_name</code> and inside of category all post</strong>?</p>
  
  <p><strong>Updated</strong></p>
  
  <p>Post table</p>
  
  <pre><code>id | post_name | post_description | category_name | etc..
  </code></pre>
  
  <p>Here category name is not using any other table since its predefined values like news, sports, cricket something like... When i am inserting news, sports, political in <code>categoryname</code>.</p>