如何在Laravel中添加请假柜台?

时间:2019-04-19 09:36:12

标签: php laravel mongodb laravel-blade

我有2列病假和请假,我的数据库中有2片病假,所以我想把这留给病假,而不是显示1,我该如何解决?

这是我的查看文件代码

<td>
@foreach($employeeLeave as $empleave)
@if($empName['personal_detail']['first_name'] == $empleave->name)
   @if($empleave->type == 'casual')
      {{ count([$empleave->type]) }}
   @endif
@endif
@endforeach
</td>
<td>
@foreach($employeeLeave as $empleave)
@if($empName['personal_detail']['first_name'] == $empleave->name)
   @if($empleave->type == 'medical')
      {{ count([$empleave->type]) }}
   @endif
@endif
@endforeach
</td>

1 个答案:

答案 0 :(得分:0)

您可以先执行以下操作:先计数循环再填充

    private static System.ServiceModel.Channels.Binding GetBindingForEndpoint(EndpointConfiguration endpointConfiguration)
    {
        if ((endpointConfiguration == EndpointConfiguration.BasicHttpBinding_IMJRFFrasCdadesService))
        {
            System.ServiceModel.BasicHttpBinding result = new System.ServiceModel.BasicHttpBinding();
            result.MaxBufferSize = int.MaxValue;
            result.ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max;
            result.MaxReceivedMessageSize = int.MaxValue;
            result.AllowCookies = true;
            return result;
        }
        if ((endpointConfiguration == EndpointConfiguration.BasicHttpsBinding_IMJRFFrasCdadesService))
        {
/*HERE -->*/ System.ServiceModel.BasicHttpsBinding result = new System.ServiceModel.BasicHttpsBinding();
            result.MaxBufferSize = int.MaxValue;
            result.ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max;
            result.MaxReceivedMessageSize = int.MaxValue;
            result.AllowCookies = true;
            result.Security.Mode = System.ServiceModel.BasicHttpsSecurityMode.Transport;
            return result;
        }
        throw new System.InvalidOperationException(string.Format("No se pudo encontrar un punto de conexión con el nombre \"{0}\".", endpointConfiguration));
    }

然后是您的html

@php
$casualCount = $medicalCount = 0;
@endphp
@foreach($employeeLeave as $empleave)
   @if($empName['personal_detail']['first_name'] == $empleave->name)
        @if($empleave->type == 'casual')
             @php $casualCount++; @endphp
        @endif
        @if($empleave->type == 'medical')
            @php $medicalCount++; @endphp
        @endif
   @endif
@endforeach