title: Laravel 5.7 - upload to public folder
body: <p>I know this question has been posted several times, but I can't get it.</p>
  
  <p>Now I use :</p>
  
  <pre><code> // photo upload
   $dir = strtolower(str_random(2));
   $image = $request-&gt;file('image')-&gt;store('products/'. $dir);
  </code></pre>
  
  <p>It works perfectly, my file is uploaded to :</p>
  
  <pre><code>storage/app/products/ds/HASH.jpg
  </code></pre>
  
  <p>But it's not public, I saw the documentation, but I can't understand how to upload to public folder easily.</p>
  
  <p>Can I use the <code>store</code> function ? I want the same behavior : the filename is hashed, the folder is created on the fly.</p>
  
  <p>I tried :</p>
  
  <pre><code>Storage::setVisibility($image, 'public');
  </code></pre>
  
  <p>But it doesn't work (no error...). </p>
  
  <p>The doc says to use :</p>
  
  <pre><code>Storage::put('file.jpg', $contents, 'public');
  </code></pre>
  
  <p>But how can I fill the <code>$content</code> variable ? How can I have the filename hashed easily ?</p>