Laravel file name database
<p>In <code>Laravel 5.3</code> I'm uploading files like this:</p>

<pre><code>public function upload(Request $request, User $user, $directory)
{
    if($request-&gt;hasFile('attachment'))
    {
        $attachments = $request-&gt;file('attachment');
        foreach ($attachments as $attachment) {
            $fileName = $attachment-&gt;store('users/' . $user-&gt;id . '/' . $directory);
            $file = new File;
            $file-&gt;path = $fileName;
            $file-&gt;user_id = $user-&gt;id;
            $this-&gt;files()-&gt;save($file);
        }
    }
}
</code></pre>

<p>So it's being stored like this:</p>

<p><a href="https://i.stack.imgur.com/yIE4c.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yIE4c.png" alt="enter image description here"></a></p>

<p>How do I store a random name (path) instead of a entire path?</p>

<p>(Random unique name something like: <code>7b11ae012907b5811cb6985d39e16052</code>)</p>