title: What is the best way to create file folder for specifi user in laravel?
body: <p>I have a simple dashboard in which users can register and do some stuff, now I would like to generate a file with username and his id; something like <code>widget/obama2030.js</code> in Laravel when a user is registered</p>
  <p>my app structure:</p>
  <p>myapp</p>
  <pre><code>-app
  -bootstrap
  -database
  -resource
   .....
  -widget
   -------
  </code></pre>
  <p>in my user registration controller, I have the following.</p>
  <pre><code>protected function create(array $data)
  {
      $user = User::create([
          'name' =&gt; $data['name'],
          'email' =&gt; $data['email'],
          'password' =&gt; bcrypt($data['password']),
          ]);
     
      File::makeDirectory('/widget/'.$user-&gt;name.Auth::user()-&gt;id, 0755, true);
  
      return $user;
  }
  </code></pre>
  <p>Now when user click the button register I am getting the following error</p>
  <pre><code>ErrorException (E_NOTICE)
  Trying to get property of non-object
  </code></pre>
  <p>what is wrong with my code????</p>