Laravel validation checkbox
<p>I am using the laravel register function to register a user. I added a checkbox where the user needs to accept the terms and conditions. I only want the user to register when the checkbox is checked. Can I use the 'required' validation in laravel? This is my validation function:</p>
<pre><code> return Validator::make($data, [
        'firstName' =&gt; 'required|max:255',
        'lastName' =&gt; 'required|max:255',
        'email' =&gt; 'required|email|max:255|unique:users',
        'password' =&gt; 'required|confirmed|min:6',
        'checkbox' =&gt;'required',
    ]);
</code></pre>
<p>When I use the function like this, laravel gives the required error for the checkbox even if it is checked.</p>
<p>This is the html of the checkbox</p>
<pre><code>&lt;input type=&quot;checkbox&quot; name=&quot;checkbox&quot; id=&quot;option&quot; value=&quot;{{old('option')}}&quot;&gt;&lt;label for=&quot;option&quot;&gt;&lt;span&gt;&lt;/span&gt; &lt;p&gt;Ik ga akkoord met de &lt;a href=&quot;#&quot;&gt;algemene voorwaarden&lt;/a&gt;&lt;/p&gt;&lt;/label&gt;
</code></pre>
<p>I hope you guys can help me!</p>