Validating a JSON array in Laravel
<p>I have a controller which receives a following POST request:</p>

<pre><code>{
  "_token": "csrf token omitted",
  "order": [1,2,3,4,5,6,7,8]
}
</code></pre>

<p>How can I use validators to ensure that elements in <code>order</code> are unique, and between 1 and 7? I have tried the following:</p>

<pre><code>$this-&gt;validate($request, [
    'order' =&gt; 'required|array',
    'order.*' =&gt; 'unique|integer|between:1,7'
]);
</code></pre>

<p>The first clause is checked, the secound one passes even when the input is invalid.</p>