title: how to use condition if using DB::table
body: <p>I'm trying to update or insert base on condition, but I'm getting error this condition not working.
  If it notification_status DELETED it was updated table and also it create new record at same time</p>
  <p><strong>code</strong></p>
  <pre><code>use App\Notification;
  
  
    if(DB::table('notifications')-&gt;where('user_id',$request-&gt;user_id)-&gt;where('notification_status', '=', 'ACTIVE' )){
   DB::table('notifications')-&gt;update(['user_name' =&gt; $request-&gt;user_name,]);//if notification_status ACTIVE IT GET UPDATE
      }else{
   DB::table('notifications')-&gt;insert(['user_name' =&gt; $request-&gt;user_name,]);//if notification_status DELETED CREATE NEW RECORD
      }
  </code></pre>