Add an @isset
directive
<select multiple="multiple" name="warehouseId[]" id="warehouse" class="form-control" style="width:100%;">
@if($warehouseData)
@foreach ($warehouseData as $key => $warehouse)
@isset($adminUserWarehouseSelectedData[$key]->id)
<option value="{{$warehouse->id}}">
{{$warehouse->name}} {{$adminUserWarehouseSelectedData[$key]->id}}
</option>
@endisset
@endforeach
@endif
</select>
2
solved Undefined offset: 2 in Laravel 5