title: Laravel return old input of checkbox array
body: <p>Edit: my $id contains an array</p>
  
  <pre><code>@php($ids = array('Fruit','Vegetables')
  </code></pre>
  
  <p>I just want to display the old input of my checkbox and textarea when the page returns with errors based on my validations.
  Here is the form elements. I tried using the old(method) but its not working for me.</p>
  
  <pre><code>&lt;form method = "post" action = "tomyController"&gt;
  &lt;input type = "text" name = "vendor" &gt;
  @foreach($ids as $id)
  &lt;input type = "checkbox" name = "check[{{$id}}][0]" value = "0"&gt;
  &lt;input type = "checkbox" name = "check[{{$id}}][1]" value = "1"&gt;
  &lt;textarea name = "remarks[{{id}}]"&gt;&lt;/textarea&gt;
  @endforeach
  &lt;/form&gt;
  </code></pre>
  
  <p>I tried the <a href="https://stackoverflow.com/questions/39521726/how-to-show-old-data-of-checkbox-in-laravel">How to show old data of checkbox in Laravel?</a> but didnt work on mine.
  Here is how i implemented it.</p>
  
  <pre><code>&lt;form method = "post" action = "tomyController"&gt;
  @foreach($ids as $id)
  &lt;input type = "checkbox" name = "check[{{$id}}][0]" value = "0" 
  @if(is_array(old('check[$id][0]')) &amp;&amp; in_array(0, old('check[$id][0]'))) checked @endif)&gt;
  &lt;input type = "checkbox" name = "check[{{$id}}][1]" value = "1" 
  @if(is_array(old('check[$id][1]')) &amp;&amp; in_array(1, old('check[$id][1]'))) checked @endif)&gt;
  &lt;textarea name = "remarks[{{id}}]"&gt;{{ old('remarks[$id]') }}&lt;/textarea&gt;
  @endforeach
  &lt;/form&gt;
  </code></pre>
  
  <p>My controller code is here. </p>
  
  <pre><code>public function store(Request $request) {
  $post    = $request-&gt;all();
  $validator = Validator::make($request-&gt;all(), [
  "vendor" =&gt; "required",
  ]);
  if ($validator-&gt;fails()) {
  return redirect()-&gt;back()
  -&gt;withErrors($validator)
  -&gt;withInput($post);
  }
  else
  #my other codes
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/mILrC.png" rel="nofollow noreferrer">dd($request)</a></p>