title: Joins queries to get multiple data to datatable in laravel
body: <p>I want to display some multiple values in a one column of the datatable. I have joined two tables to show the values in datatable. It includes customer data, and customer has multiple services that data gets from a another join query. how can i combine these together to display multiple service values according to each customer in datatable. I'm new to laravel and appreciate your help!</p>
  
  <p>Join query to pass data to datatable without multiple values:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>    public function getAppointmentData(Request $request)
      {
  
          $getData = DB::table('customers')
          -&gt;join('jobs', 'jobs.id', '=', 'customers.id')
          -&gt;select('jobs.id', 'user_type','firstname','lastname', 'vehiclemodel', 'date', 'time', 'payment_status', 'amount')-&gt;get();
  
          $datatable = DataTables::of($getData)-&gt;make(true);
          return $datatable;
      }</code></pre>
  </div>
  </div>
  </p>
  
  <p>get multiple service values according to each customer:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>        $getData = DB::table('customers')
          -&gt;join('customer_service', 'customer_service.customer_id', '=', 'customers.id')
          -&gt;join('services_info', 'services_info.id', '=', 'customer_service.id')
          -&gt;select('customer_id','service_id','service')
          -&gt;get();
  
    </code></pre>
  </div>
  </div>
  </p>
  
  <p>Output of above code:</p>
  
  <p><a href="https://i.stack.imgur.com/aF1z7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aF1z7.png" alt="enter image description here"></a></p>
  
  <p>Datatable i already have:</p>
  
  <p><a href="https://i.stack.imgur.com/iNcnF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iNcnF.png" alt="enter image description here"></a></p>
  
  <p>I want a service column in datatable to show multiple service values according to each customer.</p>