title: Class file not found in laravel?
body: <p>Following <a href="https://www.positronx.io/laravel-file-upload-with-validation/" rel="nofollow noreferrer">this</a> tutorial on how to make uploads in laravel, encountered the following error <code>Class 'App\Models\File' not found</code><br />
  When typing <code>php artisan serve</code> in the terminal the server works fine but when you upload a file it throws the error mentioned above</p>
  <p>I followed the steps carefully and checked <code>File.php</code> , <code>FileUpload.php</code></p>
  <p><code>FileUpload.php</code></p>
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers;
  
  use Illuminate\Http\Request;
  use App\Models\File;
  
  
  class FileUpload extends Controller
  {
    public function createForm(){
      return view('file-upload');
    }
  
    public function fileUpload(Request $req){
          $req-&gt;validate([
          'file' =&gt; 'required|mimes:csv,txt,xlx,xls,jpg,png,pdf|max:4096'
          ]);
  
          $fileModel = new File;
  
          if($req-&gt;file()) {
              $fileName = time().'_'.$req-&gt;file-&gt;getClientOriginalName();
              $filePath = $req-&gt;file('file')-&gt;storeAs('uploads', $fileName, 'public');
  
              $fileModel-&gt;name = time().'_'.$req-&gt;file-&gt;getClientOriginalName();
              $fileModel-&gt;file_path = '/storage/' . $filePath;
              $fileModel-&gt;save();
  
              return back()
              -&gt;with('success','File has been uploaded.')
              -&gt;with('file', $fileName);
          }
     }
  
  }
  
  </code></pre>
  <p>App\Models\File.php</p>
  <p><code>File.php</code></p>
  <pre><code>&lt;?php
  
  use Illuminate\Database\Migrations\Migration;
  use Illuminate\Database\Schema\Blueprint;
  use Illuminate\Support\Facades\Schema;
  
  class CreateFilesTable extends Migration
  {
      public function up()
      {
          Schema::create('files', function (Blueprint $table) {
              $table-&gt;id();
              $table-&gt;string('name')-&gt;nullable();
              $table-&gt;string('file_path')-&gt;nullable();
              $table-&gt;timestamps();
          });
      }
  
      public function down()
      {
          Schema::dropIfExists('files');
      }
  }
  
  </code></pre>
  <p>I get the error at line 20 in <code>app/Http/Controllers/FileUpload</code></p>