title: Display the existing image in edit form and update it using laravel
body: <p>I am able to display the existing text like name and address but unable to display Image in edit form.
  My show.blade.php  </p>
  
  <pre><code> @section('content')
          &lt;p&gt;This is user {{ $profile-&gt;name }}&lt;/p&gt;
          &lt;p&gt;This is address {{ $profile-&gt;address }}&lt;/p&gt;
           &lt;img src= "/storage/images/{{ $profile-&gt;images }}" style="width:504px;height:228px /&gt;     
   @endsection 
  </code></pre>
  
  <p>this works  fine.</p>
  
  <p>now edit.blade.php</p>
  
  <pre><code>&lt;div class="container"&gt;
    &lt;form method="POST" action="/profiles/{{$profile-&gt;id}}" enctype="multipart/form-data"&gt;
      {{ method_field('PATCH') }}
      {{ csrf_field() }}
      &lt;div class="form-group"&gt;
      name  &lt;input type="text" name="name" value="{{ $profile-&gt;name }}" /&gt;
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
       address  &lt;input type="textarea" name="address" value="{{ $profile-&gt;address }}" /&gt;
      &lt;/div&gt; 
      &lt;div class="form-group"&gt;
      @if ("/storage/images/{{ $profile-&gt;images }}")
          &lt;img src="{{ $profile-&gt;image }}"&gt;
      @else
              &lt;p&gt;No image found&lt;/p&gt;
      @endif
          image &lt;input type="file" name="image" value="{{ $profile-&gt;images }}"/&gt;
      &lt;/div&gt;
      &lt;div class="form-group"&gt;
          &lt;button type="submit" class="btn btn-primary"&gt;Submit&lt;/button&gt;
      &lt;/div&gt;``
  
  &lt;/div&gt;
  </code></pre>
  
  <p>when I try to save the  form a diffrent images path is saved in database table when updating the images ie</p>
  
  <pre><code> /tmp/phpHs0Io6
  </code></pre>
  
  <p>store  controller is</p>
  
  <pre><code>public function store(Request $request)
  {
         $this-&gt;validate($request, [
          'name' =&gt; 'required|max:255',
           'address' =&gt; 'nullable' ,
      ]);
         $profile = new profile;
         $profile-&gt; user_id = auth()-&gt;id();
         $profile-&gt; name = $request-&gt;name;
         $profile-&gt; address = $request-&gt;address;         
         $request-&gt;image-&gt;store('public/images');
         $path = $request-&gt;image-&gt;hashName();
         $profile-&gt; images = $path;
         $profile-&gt;save();
         return redirect('/home');
  }
  </code></pre>
  
  <p>and update controller is </p>
  
  <pre><code>public function update(Request $request, profile $profile)
      {
          $this-&gt;validate($request, [
              'name' =&gt; 'required|max:255',
               'address' =&gt; 'nullable' ,
          ]);
             $profile-&gt;update($request-&gt;all());
             $profile-&gt; name = $request-&gt;name;
             $profile-&gt; address = $request-&gt;address;         
             $request-&gt;image-&gt;store('public/images');
             $path = $request-&gt;image-&gt;hashName();
             $profile-&gt; images = $path;
             $profile-&gt;save();
             return redirect('/home');
      }
  </code></pre>