title: Laravel: Get id from database in controller and update data
body: <p>I need to get the id from the $client and send the id to insert it into the database.</p>
  
  <pre><code> $client = DB::table('clients')-&gt;where('product_id', '=', $request-&gt;get('product'))-&gt;get();
   $invoice = new Invoice();
   $invoice-&gt;total = ($request-&gt;get('subscription'))*1.15;
   $invoice-&gt;client_id = //get id from $client;
   $invoice-&gt;save();
  </code></pre>
  
  <p>$client = [{"id":23,"name":"testname","product_id":678}]</p>
  
  <p>Anyone have an idea how to get id from $client?</p>