douxu2467 2017-08-14 08:47
浏览 114

如果created_time超过一年,Laravel 5.4将显示另一个按钮续订

I am new to laravel and I want to pass a data to display a new button for renewal of application when the user application is already more than one year. But if the application is not more than one year it will not display the renew button. I tried using blade @if else statement in the datatable but it does not display the information when I tried to use @if else statement using blade and it says:

DataTables warning: table id=dataTableBuilder - Ajax error. For more information about this error, please see http://datatables.net/tn/7

Here is the code in my

datatables_actions.blade.php

{!! Form::open(['route' => ['applicant.applications.destroy', $application_number], 'method' => 'delete']) !!}
<div class='btn-group'>
    <a href="{{ route('applicant.applications.show', $application_number) }}" class='btn btn-default btn-xs'>
        <i class="glyphicon glyphicon-eye-open"></i>
    </a>
    @if ($application->created_at->gt(\Carbon\Carbon::now()->addYear()))
        <a href="{{ route('applicant.applications.renew', $application_number) }}" class="btn btn-primary btn-xs">
        </a>
    @endif
   <!--  <a href="{{ route('applicant.applications.edit', $application_number) }}" class='btn btn-default btn-xs'>
        <i class="glyphicon glyphicon-edit"></i>
    </a> -->
   <!--  {!! Form::button('<i class="glyphicon glyphicon-trash"></i>', [
        'type' => 'submit',
        'class' => 'btn btn-danger btn-xs',
        'onclick' => "return confirm('Are you sure?')"
    ]) !!} -->
</div>
{!! Form::close() !!}
  • 写回答

1条回答 默认 最新

  • dqy27359 2017-08-14 09:24
    关注

    You are missing </a> closing tag

    Try with a different comparation:

    {!! Form::open(['route' => ['applicant.applications.destroy', $application_number], 'method' => 'delete']) !!}
    <div class='btn-group'>
        <a href="{{ route('applicant.applications.show', $application_number) }}" class='btn btn-default btn-xs'>
            <i class="glyphicon glyphicon-eye-open"></i>
        </a>
        @if ($application->created_at->diffInYears(\Carbon\Carbon::now())>=1)
            <a href="{{ route('applicant.applications.renew', $application_number) }}" class="btn btn-primary btn-xs"></a>
            </a>
        @endif
       <!--  <a href="{{ route('applicant.applications.edit', $application_number) }}" class='btn btn-default btn-xs'>
            <i class="glyphicon glyphicon-edit"></i>
        </a> -->
       <!--  {!! Form::button('<i class="glyphicon glyphicon-trash"></i>', [
            'type' => 'submit',
            'class' => 'btn btn-danger btn-xs',
            'onclick' => "return confirm('Are you sure?')"
        ]) !!} -->
    </div>
    {!! Form::close() !!}
    
    评论

报告相同问题?

悬赏问题

  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了