title: Undefined offset: 2 in Laravel 5
body: <p>I want to keep the values in multiselect however, it shows Undefined offset: 2. The codes is below for the blade file.</p>
  
  <pre><code>&lt;select multiple="multiple" name="warehouseId[]" id="warehouse" class="form-control" style="width:100%;"&gt;
  @if($warehouseData)
    @foreach ($warehouseData as $key =&gt; $warehouse)
      &lt;option value="{{$warehouse-&gt;id}}" &gt;{{$warehouse-&gt;name}} {{$adminUserWarehouseSelectedData[$key]-&gt;id}}&lt;/option&gt;
    @endforeach
  @endif
  &lt;/select&gt;
  </code></pre>