title: How to update a product in Laravel 5.8
body: <p>I have a product that I want to edit. Please see the following code.</p>
  
  <pre class="lang-php prettyprint-override"><code>public function update(ProductRequest $request, Product $product)
  {
      $product-&gt;user_id = auth()-&gt;user()-&gt;id;
      $product-&gt;title = $request-&gt;title;
      $product-&gt;body = $request-&gt;body;
      $product-&gt;price = $request-&gt;price;
  
      if ($request-&gt;has('image')) {
          $image = $request-&gt;file('image');
          $filename = $image-&gt;getClientOriginalName();
          $image-&gt;move(public_path('images/products'), $filename);
          $product-&gt;image = $request-&gt;file('image')-&gt;getClientOriginalName();
      }
      $product-&gt;update();
      $product-&gt;categories()-&gt;sync($request-&gt;category);
  
      return redirect()-&gt;route('products.index');
  }
  </code></pre>
  
  <p><strong>product.blade.php</strong></p>
  
  <pre><code>&lt;form class="form-horizontal" action="{{ route('products.update', $product-&gt;id) }}" method="post" enctype="multipart/form-data"&gt;
  {{ csrf_field() }}
  {{ method_field('PATCH') }}
  .
  .
  .
  </code></pre>
  
  <p>Everything changes except the image. I tried it, but, I did not succeed. What's the solution? I want to update the image in the database.</p>
  
  <p>OK, I go to database now, I changed in image to picture, then I go my project, and I tested this again.</p>
  
  <p>But it did not event for me.</p>
  
  <p>I changed </p>
  
  <pre><code>public function update(ProductRequest $request, Product $product)
  </code></pre>
  
  <p>To</p>
  
  <pre><code>public function update(Request $request, Product $product)
  </code></pre>