lundi 27 novembre 2017

@foreach in @foreach have double data laravel

I have two array $softwarelist and $virt_software_select when i use @foreach in blade template like below code i got checked but $softwarelist is double in label.

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

@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=""/> 
                  
            </label>
        @else
            <label>
                <input type="checkbox" name="virt_software[]" value=""/> 
                  
            </label> 
        @endif
    @endforeach
@endforeach

How can i get checked the same data in two array but not double data with $softwarelist in laravel?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire