第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

如何根據(jù)其值在HTML單元格中添加類(lèi)

如何根據(jù)其值在HTML單元格中添加類(lèi)

PHP
梵蒂岡之花 2021-05-10 20:33:51
我有以下循環(huán),其中我從查詢(xún)中提取值并用表編寫(xiě)表,在該字段中,我需要根據(jù)從發(fā)貨日期到今天為止所經(jīng)過(guò)的天數(shù),更改年齡的字段我已經(jīng)在CSS中嘗試過(guò)了[data-age> 180],但是我只遇到錯(cuò)誤,而且找不到與我的需求類(lèi)似的情況,另外,id喜歡在循環(huán)內(nèi)進(jìn)行操作,而不是另外的代碼,因?yàn)樗獊y了我的視線(xiàn)@foreach($shipments as $shipment)  <tr>    <td data-title="id">{{$shipment->id}}</td>    <td class=tracking data-title="tracking">{{$shipment->tracking}}</td>    <td data-title="PartNumber">{{$shipment->PartNumber}}</td>    <td data-title="DateShipped">{{$shipment->DateShipped}}</td>    <td       data-title="age"       data-age="{{        (int) floor(          (time() - strtotime($shipment->DateShipped))           / (60 * 60 * 24)        )      }}"    >{{      (int) floor(        (time() - strtotime($shipment->DateShipped)) / (60 * 60 * 24)      )    }} days    </td>    <td data-title="Qtyorder">{{$shipment->Qtyorder}}</td>    <td data-title="QtyShipped">{{$shipment->QtyShipped}}</td>    <td data-title="QtyBckorder">{{$shipment->QtyBckorder}}</td>    <td data-title="purchaseOrder">{{$shipment->purchaseOrder}}</td>    <td data-title="OrderNumber">{{$shipment->OrderNumber}}</td>    <td data-title="paperwork">{{$shipment->paperwork}}</td>    <td data-title="VMIreceived">{{$shipment->VMIreceived}}</td>    <td data-title="VMIticketNumber">{{$shipment->VMIticketNumber}}</td>    <td data-title="VMILRB">{{$shipment->VMILRB}}</td>    <td>      <a         href="{{ route('shipment.edit',$shipment->id)}}"         class="btn btn-primary"      >        Edit      </a>    </td>    <td>      <form action="{{ route('shipment.destroy', $shipment->id)}}" method="post">        @csrf        @method('DELETE')        <button class="btn btn-danger" type="submit">Delete</button>      </form>    </td>  </tr>@endforeach
查看完整描述

2 回答

?
狐的傳說(shuō)

TA貢獻(xiàn)1804條經(jīng)驗(yàn) 獲得超3個(gè)贊

未經(jīng)測(cè)試,但是您可以嘗試以下操作:


@foreach($shipments as $shipment)

  @php

    $time_passed = $shipment->DateShipped->diffInSeconds(now());

  @endphp


  <tr>

    <td class="{{ time_passed > some_number ? 'class_value_if_true' : 'class_value_if_false' }}">

      {{ $time_passed }}

    </td>

  </tr>

@endforeach


查看完整回答
反對(duì) 回復(fù) 2021-05-28
?
吃雞游戲

TA貢獻(xiàn)1829條經(jīng)驗(yàn) 獲得超7個(gè)贊

嘗試一行if語(yǔ)句

{{ $condition ? value if true : value if false }}


查看完整回答
反對(duì) 回復(fù) 2021-05-28
  • 2 回答
  • 0 關(guān)注
  • 135 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)