I\'m getting this weird error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column \'0\' in \'field list\' (SQL: update forum_threads set
forum_threads
As I mentioned in the comment section, change your function to this:
public function scopeLock($query) { return $query->where('locked', 0)->update(['locked' => 1]); }
Note the changes in the update method.