title: How to get comma separated values from a table in Laravel
body: <p>This is my <strong>Categories Table</strong>:</p>
  
  <pre><code>id  | name
   1    a
   2    b
   3    c
   4    d
  </code></pre>
  
  <p>In which I need to get the values of <strong>1</strong> and <strong>2</strong> in comma separated manner, i.e. <strong>a,b</strong>.</p>
  
  <p>I tried something like this:</p>
  
  <pre><code>$ids = array('0'=&gt;1,'1'=&gt;2);
  \DB::select('SELECT group_concat(name) as name from category where id = ?', ($ids));
  </code></pre>
  
  <p>But it always returns the first value (i.e., <strong>a</strong>)</p>
  
  <p>I need the resultant values to be like this: <strong>a,b</strong>.</p>
  
  <p>How could I do this either using normal query or by Laravel?</p>
  
  <p>Thank you.</p>