title: Laravel updateOrCreate And Increment Value
body: <p>In my app, i'm saving customer interests depending on viewing products, adding to carts, orders and category viewing.</p>
  
  <p>Now here is my customerInterestController</p>
  
  <pre><code>$customerInterest = [
        'user_id'           =&gt; Auth::user()-&gt;id,
        'interest'          =&gt; $category_id,
     ];
  
     $data = [
        'cart_interest'     =&gt; ($column == 'cart') ? 1 : 0,
        'order_interest'    =&gt; ($column == 'order') ? 1 : 0,
        'category_interest' =&gt; ($column == 'category') ? 1 : 0,
        'view_interest'     =&gt; ($column == 'view') ? 1 : 0,
     ];
  
     try{
         (new CustomerInterest)-&gt;insertCustomerInterest($customerInterest, $data);
     }catch(Exception $e){
         dd($e);
     }
  </code></pre>
  
  <p>And here is my customerInterest Model</p>
  
  <pre><code>public function insertCustomerInterest($customerInterest = [], $data = []){
      return $this-&gt;updateOrCreate($customerInterest, $data);
  }
  </code></pre>
  
  <p>There is no problem with inserting database. It works.</p>
  
  <pre><code>My Table
  
  id
  user_id
  interest
  cart_interest
  order_interest
  category_interest
  view_interest
  </code></pre>
  
  <p><strong>user_id</strong> and <strong>interest</strong> columns are <strong>composite</strong> <strong>unique</strong> index.</p>
  
  <p>If user_id, interest columns exists</p>
  
  <p>i want to update data</p>
  
  <p>if not i want to insert data.</p>
  
  <p>I use <strong>updateOrCreate</strong> method but couldn't increase the values in <strong>$data</strong> array.</p>
  
  <p>How can i do that ?</p>