dimanche 17 mars 2019

Do not show if 1 variables are equal to 0 and the other one is empty in laravel

I don't know why I can't make this condition work. First I'll show you may foreach table.

@foreach( $w1ProductHistory as $w1ph )
    @php
    $totalCost = $w1ph->orderItem->cost * $w1ph->stock_in_qty;
    @endphp
    @if($w1ph->stock_in_qty!='0' && $w1ph->delivery_note!='')
    <tr>
        <td></td>
        <td></td>
        <td><a href="" class="text-info"></a></td>
        <td></td>
        <td></td> 
        <td></td>
        <td></td>
        <td></td>
        <td>
            @if(isset($w1ph->delivery_note))
                <a data-placement="left" data-toggle="tooltip" title="Delivery Notes: " href=" --}}" class="btn btn-sm btn-icon btn-default"><i class="fab fa-readme"></i></a>
            @endif
        </td>
    </tr>
    @endif
@endforeach

What I am trying to do is to hide if only $w1ph->stock_in_qty!='0 and $w1ph->delivery_note!=''.

if $w1ph->stock_in_qty!='0 but $w1ph->delivery_note!='' has value, the row should be display.

I already tried @if($w1ph->stock_in_qty!='0' && $w1ph->delivery_note!='') , @if($w1ph->stock_in_qty!='0' && !empty($w1ph->delivery_note)) even changing the "&&" to and. still it hides the row even with only one condition is met.

Again, I am trying to hide the row only if both condition is meet not either 1 of them. How can I achieve it? thanks in advance!

Aucun commentaire:

Enregistrer un commentaire