@foreach中@foreach有双数据laravel

时间:2017-11-28 03:35:50

标签: php laravel laravel-5 laravel-blade

我在刀片模板中使用$softwarelist时有两个数组$virt_software_select@foreach,如下面的代码我已经检查但$softwarelist标签是双倍的。

$softwarelist =["Adobe Photoshop","Adobe Illustrator","Corel Draw","My SQL","Oracle"];
$virt_software_select=["Adobe Photoshop","My SQL"];

@foreach($softwarelist as $slst)
    @foreach($virt_software_select as $sw_usr)
        @if($slst->software==$sw_usr->virtualize_software)
            <label>
                <input type="checkbox" checked name="virt_software[]" value="{{$slst->software}}"/> 
                  {{$slst->software}}
            </label>
        @else
            <label>
                <input type="checkbox" name="virt_software[]" value="{{$slst->software}}"/> 
                  {{$slst->software}}
            </label> 
        @endif
    @endforeach
@endforeach
我得到了这些 enter image description here

如何在两个数组中检查相同的数据,而不是在laravel中检查$softwarelist的双数据?

0 个答案:

没有答案