Laravel Blade Count Rows

时间:2018-04-04 11:04:28

标签: laravel-5 relationship laravel-blade countrows

美好的一天,我真的可以使用一些指导我试图计算

的行数
  

表字段值= $ someValue

  

回显计数

我怎么能做到这一点?

像这样:

   def extractfeatures(sh):
     vals = sh.row_values  
     data=[]
     for r in range(sh.nrows):
        if vals(r,0)[1] in TimeList:
             if vals(r,0)[0] == 'id1':
                data.append([vals(r,0)[4]])
             if vals(r,0)[0] == 'id2':
                data.append([vals(r,0)[3], vals(r,0)[4]])
             if vals(r,0)[0] == 'id3':
                data.append([vals(r,0)[i] for i in range (3,19)]) 

     return data

1 个答案:

答案 0 :(得分:0)

我设法得到了我需要的计数:

{{ count($seta->staffaccred->where('column', 'value')) }}

@foreach($setas as $seta)

           <tr>
               <td>{{ $seta->name }}</td>
               <td>{{  count($seta->staffaccred->where('status', 'Expired')) }}</td>
           </tr>

    @endforeach