Browse Source

修复select表单会默认选中key为0的选项问题

jqh 5 years ago
parent
commit
dc0a04c56c
1 changed files with 1 additions and 1 deletions
  1. 1 1
      resources/views/form/select.blade.php

+ 1 - 1
resources/views/form/select.blade.php

@@ -23,7 +23,7 @@
              @else
              @else
                 <option value=""></option>
                 <option value=""></option>
                 @foreach($options as $select => $option)
                 @foreach($options as $select => $option)
-                    <option value="{{$select}}" {{ $select == old($column, $value) ?'selected':'' }}>{{$option}}</option>
+                    <option value="{{$select}}" {{ (string) $select === (string) old($column, $value) ?'selected':'' }}>{{$option}}</option>
                 @endforeach
                 @endforeach
             @endif
             @endif
         </select>
         </select>