title: Undefined array key - Laravel/Fortify Register
body: <p>Simply its a register page in Laravel ..
  User have to check the checkbox if its teacher if not is student.</p>
  <p>Thus I tried to do with value 1 teacher 0 student but I dont know how to get this value in controller .</p>
  <p>Also tried below code ( <code>'role_id' =&gt;  $input['role_id'],</code> ) when checked it returns  &quot;on&quot; on database but non-checked it throws error</p>
  <blockquote>
  <p>Undefined array key &quot;role_id&quot;</p>
  </blockquote>
  <p>Register view..</p>
  <pre><code>&lt;div class=&quot;form-group form-check&quot;&gt;
     &lt;input type=&quot;checkbox&quot; class=&quot;form-check-input&quot; id=&quot;role_id&quot; name=&quot;role_id&quot; value=&quot;0&quot; 
     &lt;label class=&quot;form-check-label&quot; for=&quot;exampleCheck1&quot;&gt;Teacher&lt;/label&gt;
  &lt;/div&gt;
  </code></pre>
  <p>Fortify Controller..</p>
  <pre><code>/**
   * Validate and create a newly registered user.
   *
   * @param  array  $input
   * @return \App\Models\User
   */
  public function create(array $input)
  {
      Validator::make($input, [
          'name' =&gt; ['required', 'string', 'max:255'],
          'email' =&gt; [
              'required',
              'string',
              'email',
              'max:255',
              Rule::unique(User::class),
          ],
          'password' =&gt; $this-&gt;passwordRules(),
      ])-&gt;validate();
  
      return User::create([
          'name' =&gt; $input['name'],
          'email' =&gt; $input['email'],
          'password' =&gt; Hash::make($input['password']),
          'role_id' =&gt;  $input['role_id'],
      ]);
  }
  </code></pre>
  <p>}</p>