title: Laravel 8 Call to a member function extension() on null
body: <p>I am trying to upload an image in Laravel 8, after changing the file path to public in the config folder and setting up the Model properly. I am getting this response</p>
  <blockquote>
  <p>Call to a member function extension() on null</p>
  </blockquote>
  <p>My Product controller</p>
  <pre><code> public function store(Request $request)
      {
          $file = $request-&gt;file('image');
          $name = Str::random(10);
          $url = Storage::putFileAs('images', $file, $name . '.' . $file-&gt;extension());
  
          $product = Product::create([
              'title' =&gt; $request -&gt; input('title'),
              'description' =&gt; $request -&gt; input('description'),
              'image' =&gt; env('APP_URL') . '/' . $url,
              'price' =&gt; $request -&gt; input('price'),
          ]);
  
          return $product;
      }
  </code></pre>
  <p>My model</p>
  <pre><code>protected $guarded = ['id'];
  </code></pre>
  <p>Migration</p>
  <pre><code>public function up()
     {
          Schema::create('products', function (Blueprint $table) {
              $table-&gt;id();
              $table-&gt;string('title');
              $table-&gt;string('description')-&gt;nullable();
              $table-&gt;string('image');
              $table-&gt;decimal('price');
              $table-&gt;timestamps();
          });
      }
  </code></pre>
  <p>What have I done wrong or what am I not doing right please?</p>