title: CRUD Update with image Laravel
body: <p>I am trying to update an already saved record, which includes an image and image path in database. When I update the record, the image gets uploaded and the redirect works and shows success message, however, none of the columns in database get updated with the new data. Why is this happening??</p>
  
  <p>Here is my update method:</p>
  
  <pre><code>public function update(Request $request, $id)
      {
  
          if ($request['post_image'] != '') {
  
              $request-&gt;validate([
              'title' =&gt; 'required',
              'description' =&gt; 'required',
              'slug' =&gt; 'required',
              'message' =&gt; 'required',
              'user' =&gt; 'required',
              'post_image' =&gt; 'image|mimes:jpeg,png,jpg,gif|max:2048'
              ]);
  
              $image_path = Storage::disk('public')-&gt;putFile('uploads/images', $request-&gt;file('post_image'));
              $request['image_path'] = $image_path;
  
          }else{
  
              $request-&gt;validate([
                  'title' =&gt; 'required',
                  'description' =&gt; 'required',
                  'slug' =&gt; 'required',
                  'message' =&gt; 'required',
                  'user' =&gt; 'required'
                  ]);
          }  
  
          $update = [
              'title' =&gt;$request-&gt;title,
              'description' =&gt;$request-&gt;description,
              'slug' =&gt;$request-&gt;slug,
              'message' =&gt;$request-&gt;message,
              'user' =&gt;$request-&gt;user,
              'post_image' =&gt;$request-&gt;image_path];
  
          Post::where('id', $id)-&gt;update($update);
  
          return Redirect::to('admin')-&gt;with('success','Great! Post updated successfully');
  
      }
  </code></pre>
  
  <p>Here is the view:</p>
  
  <pre><code>&lt;form action="{{ route('blog.update', $post_info-&gt;slug) }}" method="POST" name="edit_post" role="form" enctype="multipart/form-data"&gt;
  {{ csrf_field() }}
  @method('PATCH')
  
  &lt;h1&gt;Edit Post&lt;/h1&gt;
  &lt;div role="separator" class="dropdown-divider"&gt;&lt;/div&gt; 
  
  &lt;div class="form-row"&gt;
      &lt;div class="form-group col-12 col-md-6"&gt;
        &lt;label for="title"&gt;Post Title&lt;/label&gt;
        &lt;input type="text" autocomplete="off" class="form-control" id="title" name="title" placeholder="Your post title" value="{{$post_info-&gt;title}}" required&gt;
        &lt;span class="text-danger"&gt;{{ $errors-&gt;first('title') }}&lt;/span&gt;
      &lt;/div&gt;
  
      &lt;div class="form-group col-12 col-md-6"&gt;
          &lt;label for="slug"&gt;Slug&lt;/label&gt;
        &lt;input type="text" autocomplete="off" class="form-control" id="slug" name="slug" placeholder="Write post slug" value="{{$post_info-&gt;slug}}" required&gt;
        &lt;span class="text-danger"&gt;{{ $errors-&gt;first('slug') }}&lt;/span&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div class="form-row"&gt;
      &lt;div class="form-group col-12 col-md-12"&gt;
          &lt;label for="description"&gt;Post Description&lt;/label&gt;
        &lt;textarea class="form-control" id="description" name="description" placeholder="Enter a small description for your post" required&gt;{{$post_info-&gt;description}}&lt;/textarea&gt;
        &lt;span class="text-danger"&gt;{{ $errors-&gt;first('description') }}&lt;/span&gt;
      &lt;/div&gt;
  
  
  &lt;/div&gt;
  
  
      &lt;div class="badge badge-warning badge-pill"&gt;Message&lt;/div&gt;
      &lt;div role="separator" class="dropdown-divider"&gt;&lt;/div&gt;
  
   &lt;div class="form-row"&gt;
      &lt;div class="form-group col-md-12"&gt;
          &lt;textarea class="form-control" col="4" id="message" name="message"&gt;{{$post_info-&gt;message}}&lt;/textarea&gt;
          &lt;span class="text-danger"&gt;{{ $errors-&gt;first('message') }}&lt;/span&gt;
      &lt;/div&gt;
      @if($post_info-&gt;post_image)
      &lt;img src="{{ asset('storage/' . $post_info-&gt;post_image) }}" class="img-thumbnail img-fluid blog-img"&gt;
      @endif
      &lt;input id="post_image" type="file" class="form-control" name="post_image"&gt;
  
  &lt;/div&gt;
  
  &lt;input type="hidden" value="{{ Auth::user()-&gt;name }}" name="user"&gt;
  
    &lt;button type="submit" class="btn btn-warning btn-block"&gt;Edit Post&lt;/button&gt;
  
  &lt;/form&gt;
  </code></pre>