title: which means Undefined index: team_id in Laravel
body: <p>I am in the process of changing the registration process. When the user is invited, the user is assigned to the same team. And if he registers himself, he can choose a team.</p>
  
  <p>Everything works, except with the team_id. I always get the error message:</p>
  
  <pre><code>Undefined index: team_id
  </code></pre>
  
  <p>What does the error message mean? How can I fix the error?</p>
  
  <p>I do not understand why this does not work, because the same function works with the avatar.</p>
  
  <p>Function:</p>
  
  <pre><code>/**
   * Get a validator for an incoming registration request.
   *
   * @param  array  $data
   * @return \Illuminate\Contracts\Validation\Validator
   */
  protected function validator(array $data)
  {
      return Validator::make($data, [
          'name' =&gt; 'required|string|max:30',
          'username' =&gt; 'required|string|max:20|alpha_num|unique:users',
          'email' =&gt; 'required|string|email|max:255|unique:users',
          'password' =&gt; 'required|string|min:6',
          'birthday' =&gt; 'required|date|before_or_equal:-16 years',
          'agb' =&gt; 'accepted',
          'gender' =&gt; 'required|boolean',
          'team_id' =&gt; 'numeric'
      ]);
  }
  
  /**
   * Create a new user instance after a valid registration.
   *
   * @param  array  $data
   * @return \App\User
   */
  protected function create(array $data)
  {
      if($data['gender'])
  
      {
          $avatar = 'defaults\avatars\male.jpg';
      }
  
      else
  
      {
          $avatar = 'defaults\avatars\female.jpg';
      }
  
  
  
  if($data['team_id'])
          {
              $team = $data['team_id'];
          }
  
          else
          {
              $team = Null;
          }
  
  
      $user = User::create([
          'name' =&gt; $data['name'],
          'team_id' =&gt; $team,
          'username' =&gt; $data['username'],
          'email' =&gt; $data['email'],
          'password' =&gt; bcrypt($data['password']),
          'birthday' =&gt; $data['birthday'],
          'gender' =&gt; $data['gender'],
          'slug' =&gt; str_slug($data['username']),
          'avatar' =&gt; $avatar,
          'active' =&gt; false,
          'activation_token' =&gt; str_random(255)
      ]);
  
      Profile::create(['user_id' =&gt; $user-&gt;id ]);
  
      while (true) {
          $randomstring = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyz"), 0, 7);
          if (Invite::where('url','!=', $randomstring)-&gt;exists()) {
              Invite::create([
              'user_id' =&gt; $user-&gt;id,
              'url' =&gt; $randomstring
              ]);
              break;
          }
      }
      return $user;
  }
  </code></pre>