title: update file name of a file and updating data in database at the same time in laravel
body: <p>I have a working upload file function. here's the code</p>
  
  <pre><code>public function store(Request $request)
  {  
      $request-&gt;validate([
          'name' =&gt; 'required',
          'filename' =&gt; 'required|mimes:jpeg,png,jpg,gif,svg,doc,docx,xls,xlsx,pdf,txt|max:2048',
      ]);
  
      $fileName = auth::user()-&gt;id.'_'.$name.'.'.request()-&gt;filename-&gt;getClientOriginalExtension();
  
      request()-&gt;filename-&gt;storeAs('files', $fileName);
  
      File::create ([
          'name'      =&gt; $name,
          'filename'  =&gt; $fileName,
          'user_id'   =&gt; $request['user_id'],
          'extension' =&gt; request()-&gt;filename-&gt;getClientOriginalExtension(),
      ]);
  
      return redirect('dashboard/files')-&gt;with('flash_message', 'File added!');
  }
  </code></pre>
  
  <p>now my problem is how am I going to update the filename of the file once I update the name in the database? </p>
  
  <p>thanks in advance!</p>