title: Upload Profile Picture in Laravel Registration failed
body: <p>I want to upload a profile picture at the registration</p>
  
  <p>Before i had to register the user and after that i could change the default user.jpg into my own profile picture </p>
  
  <p>but now i want to upload my profile picture at the registration </p>
  
  <p>this is the part of my view where i want to upload the picture:</p>
  
  <pre><code>&lt;div class="form-group col-md-12"&gt;
                  &lt;label&gt;Firmenlogo&lt;/label&gt;
                  &lt;div class="custom-file"&gt;
                      &lt;input type="file" name="avatar" class="custom-file-input" id="validatedCustomFile" required&gt;
                      &lt;input type="hidden" name="_token" value="{{csrf_token()}}"&gt;
                      &lt;label class="custom-file-label" for="validatedCustomFile"&gt;Datei auswählen...&lt;/label&gt;
                      &lt;div class="invalid-feedback"&gt;Bitte laden Sie hier Ihr Firmenlogo hoch.&lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
  </code></pre>
  
  <p>and this is my controller:</p>
  
  <pre><code>&lt;?php
  namespace App\Http\Controllers\Auth;
  use App\User;
  use App\Http\Controllers\Controller;
  use Illuminate\Support\Facades\Hash;
  use Illuminate\Support\Facades\Validator;
  use Illuminate\Foundation\Auth\RegistersUsers;
  
  class RegisterController extends Controller
  {
  
  use RegistersUsers;
  
  protected $redirectTo = '/admin';
  
  public function __construct()
  {
      $this-&gt;middleware('guest');
  }
  
  protected function validator(array $data)
  {
      return Validator::make($data, [
          'name' =&gt; 'required|string|max:255',
          'email' =&gt; 'required|string|email|max:255|unique:users',
          'password' =&gt; 'required|string|min:6|confirmed',
          'avatar' =&gt; 'required|string',
      ]);
  }
  
  protected function create(array $data)
  {
      return User::create([
          'name' =&gt; $data['name'],
          'email' =&gt; $data['email'],
          'password' =&gt; Hash::make($data['password']),
          'avatar' =&gt; $avatar,
      ]);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>this is my migration file:</p>
  
  <pre><code>&lt;?php
  use Illuminate\Support\Facades\Schema;
  use Illuminate\Database\Schema\Blueprint;
  use Illuminate\Database\Migrations\Migration;
  
  class CreateUsersTable extends Migration
  {
      public function up()
      {
          Schema::create('users', function (Blueprint $table) {
              $table-&gt;increments('id');
              $table-&gt;string('name');
              $table-&gt;string('email')-&gt;unique();
              $table-&gt;string('avatar')-&gt;default('default.jpg');
              $table-&gt;string('password');
              $table-&gt;rememberToken();
              $table-&gt;timestamps();
          });
      }
      return void
       */
      public function down()
      {
          Schema::dropIfExists('users');
      }
  }
  </code></pre>
  
  <p>and this is my user.php</p>
  
  <pre><code>&lt;?php
  
  namespace App;
  
  use Illuminate\Notifications\Notifiable;
  use Illuminate\Foundation\Auth\User as Authenticatable;
  
  class User extends Authenticatable
  {
      use Notifiable;
      protected $fillable = [
          'name', 'email', 'password', 'avatar',
      ];
  
      protected $hidden = [
          'password', 'remember_token',
      ];
  }
  </code></pre>
  
  <p>so everyythign works it saves the pciture as a string in my database like picture.jpg but it dont save it in my uploads folder so i try this:</p>
  
  <pre><code>$avatar = $data['avatar']-&gt;file('avatar');
      $filename = time() . '.' . $avatar-&gt;getClientOriginalExtension();
      Image::make($avatar)-&gt;resize(300, 300)-&gt;save(public_path('/uploads/avatars/'.$filename));
  </code></pre>
  
  <p>but nothings happened 
  it doesnt save anything in my database 
  if i click on register the page reload and nothing happens i dont know why
  and i dont know what to do 
  i tried so many things and read so many blogs but nothing works</p>
  
  <p>it only works after the registration if i go to my profile and upload a new picture</p>
  
  <p>but why?? so i know the code works but why not in the register controller?</p>