title: How do i update image in the repository by upload?
body: <p>I'm setting up a CRUD, similar to an ecommerce
  I uploaded the image, it is stored in the public folder. The name of the image is replaced by the value of an input that the user places. This same value is saved in the database with the image extension.
  I was also able to delete the image, but I don't know how to update it. Can someone please give me a light?</p>
  <p>project controller:</p>
  <pre><code>public function store(Request $request)
  {
      $nameFile = $request-&gt;input('imageName', '');
      if($request-&gt;file('imageFile')-&gt;isValid()){
          $nameFile .= '.' . $request-&gt;file('imageFile')-&gt;getClientOriginalExtension();
          $request-&gt;file('imageFile')-&gt;storeAs('projects', $nameFile);
      }
  
  
      $project = new Project();
  
      $project-&gt;name = $request-&gt;input('name');
      $project-&gt;price = $request-&gt;input('price');
      $project-&gt;imageName = $nameFile;
  
      $project-&gt;save(); 
  
      return redirect()-&gt;route('ProjectControllerCreate');
  }
  
  
  
  public function destroy($id)
  {   
      $project = Project::find($id);
  
      // Image
      $filePathName = public_path().'/storage/projects/'. $project-&gt;imageName;
      if( file_exists($filePathName) ){
          unlink($filePathName);
      }
  
      // Data
      if(!$project)
          return redirect()-&gt;back();
          
      $project-&gt;delete();
  
      return redirect()-&gt;route('ProjectControllerCreate');
  }
  
  public function update(Request $request, $id)
  {   
      $project = Project::find($id);
      if(!$project)
          return redirect()-&gt;back();
  
      $project-&gt;update($request-&gt;all());
  
      return redirect()-&gt;route('ProjectControllerCreate');
  }
  </code></pre>