title: Ignoring the user result input when updating data goes wrong
body: <p>I'm working on an :
  <code>edit.blade.php</code></p>
  <p>where users can edit data and the update method of Controller goes here:</p>
  <pre><code>public function update(Request $request, $id)
      {
          $discountCode = DiscountCode::find($id);
  
          $request-&gt;validate([
              'code' =&gt; 'unique:discount_codes,code'.$discountCode-&gt;id,
              'started_at' =&gt; 'required_if:timespan,TRUE',
              'ended_at' =&gt; 'required_if:timespan,TRUE',
          ],
    
          ...
      }
  </code></pre>
  <p>So as you can see the <code>code</code> must be uique in <code>discount_codes</code> table.</p>
  <p>So I tried adding :</p>
  <p><code>$discountCode-&gt;id</code></p>
  <p>in order to ignore unique validation rule for the current data but it does not work out and returns this error:</p>
  <pre><code>SQLSTATE[42S22]: Column not found: 1054 Unknown column 'code15' in 
  
  'where clause' (SQL: select count(*) as aggregate from 
  
  `discount_codes` where `code15` = GIGvJjp4PM)
  </code></pre>
  <p><strong>15</strong> is my data row id.</p>
  <p>So what's going wrong here? How can I solve this issue?</p>