title: Column not found: 1054 Unknown column '0' in 'field list' - Laravel - I don't have a 0 column anywhere in my code
body: <p>I'm getting this weird error:</p>
  
  <blockquote>
    <p>SQLSTATE[42S22]: Column not found: 1054 Unknown column '0' in 'field list' (SQL: update <code>forum_threads</code> set <code>0</code> = locked, <code>1</code> = 1, <code>updated_at</code> = 2016-03-17 16:01:59 where <code>topic_id</code> = 3 and <code>forum_threads</code>.<code>deleted_at</code> is null)</p>
  </blockquote>
  
  <p>The thing is, I don't have a 0 column. I don't have a where clause with a <code>0</code> anywhere in my code. I am using a scope query.</p>
  
  <p>My controller is:</p>
  
  <pre><code>    $action = $request-&gt;input('action');
      $topic = $request-&gt;input('topic');
      $thread = Thread::where('topic_id', $topic);
  
      switch ($action) {
          case ('locked'):
              $thread-&gt;lock();
              break;
      }
  </code></pre>
  
  <p>As you can see, I don't do much. I am just trying to lock a thread. I am calling the lock scope in my <code>Thread</code> model. I have a lot of switch cases, one of which is <code>lock</code>. I have run half of the query at the top so I don't have to repeat myself. I simply stored it in the <code>$thread</code> variable so that I can perform actions like <code>$thread-&gt;delete()</code> and <code>$thread-&gt;restore()</code>.</p>
  
  <p>My query scope in Thread model:</p>
  
  <pre><code>public function scopeLock($query)
  {
      return $query-&gt;where('locked', 0)-&gt;update(['locked', 1]);
  }
  </code></pre>
  
  <p>That's it. I think it may because I have a where clause passing from my controller (<code>Thread::where('topic_id', $topic)</code>) and I'm just continuing it onto my scope.</p>
  
  <p>Any help is highly appreciated. </p>