title: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'category' in 'field list' (SQL: update `articles` set `updated_at`)
body: <p>I have two table</p>
  
  <ul>
  <li>articles </li>
  <li>categories</li>
  </ul>
  
  <p>I have a ArticleController. I want to edit the form. But it get errors.</p>
  
  <blockquote>
    <p>SQLSTATE[42S22]: Column not found: 1054 Unknown column 'category' in
    'field list' (SQL: update <code>articles</code> set <code>updated_at</code> = 2017-12-21
    11:50:12, <code>category</code> = 1 where <code>id</code> = 1)</p>
  </blockquote>
  
  <p>ArticleController.php</p>
  
  <pre><code>public function update(ArticleRequest $request, Article $article)
      {
          $file = $request-&gt;file('images');
          $inputs = $request-&gt;all();
          $article-&gt;categories()-&gt;sync(request('category'));
  
          if($file) {
              $inputs['images'] = $this-&gt;uploadImages($request-&gt;file('images'));
          } else {
              $inputs['images'] = $article-&gt;images;
              $inputs['images']['thumb'] = $inputs['imagesThumb'];
  
          }
  
          unset($inputs['imagesThumb']);
          $article-&gt;update($inputs);
  
          return redirect(route('articles.index'));
      }
  </code></pre>
  
  <p>This error occurred on the following line.</p>
  
  <blockquote>
    <p>$article->update($inputs);</p>
  </blockquote>
  
  <p>edit.blade.php</p>
  
  <pre><code>&lt;select name="category[]" class="form-control" id="category" title=" Select your a categories..." multiple&gt;
        @foreach( $categories as $id =&gt; $name )
                 &lt;option value="{{ $id }}" {{ in_array($id , $article-&gt;categories()-&gt;pluck('id')-&gt;toArray()) ? 'selected' : '' }}&gt;{{ $name }}&lt;/option&gt;
        @endforeach
  &lt;/select&gt;
  </code></pre>
  
  <p>Category</p>
  
  <pre><code>class Category extends Model
  {
      protected $fillable = ['name', 'slug'];
  
      public function articles()
      {
          return $this-&gt;belongsToMany(Article::class);
      }
  }
  </code></pre>
  
  <p>Article</p>
  
  <pre><code>public function categories()
      {
          return $this-&gt;belongsToMany(Category::class);
      }
  </code></pre>