laravel display multiple selected values

47

$selected = explode(",", $products->supplier_id);

<select  name="supplier_id[]" multiple="multiple">
   @foreach($suppliers as $supplier)
     <option value="{{ $supplier->id }}" {{ (in_array($supplier->id, $selected)) ? 'selected' : '' }}>{{ $supplier->name}}</option>
   @endforeach
</select>

Comments

Submit
0 Comments