刀片文件中是否存在其他条件(laravel 5.3) [英] if else condition in blade file (laravel 5.3)

查看:33
本文介绍了刀片文件中是否存在其他条件(laravel 5.3)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想检查刀片文件中的 if / else 条件.我想检查条件 $ user-> status =='waiting',如下所示.输出正确返回了我预期的结果.但是随着我的输出,我抓到了花括号{}的打印.我想删除花括号,结果.我的 if 条件是否有问题?

I want to check if/else condition in my blade file. I want to check the condition $user->status =='waiting' as the code given below. Output returns correctly as I expected. But along with my output I caught curly braces {} printed. I want to remove curly braces in result. Is there anything wrong in my if condition ?

@if($user->status =='waiting')
         {
           <td><a href="#" class="viewPopLink btn btn-default1" role="button" data-id="{{ $user->travel_id }}" data-toggle="modal" data-target="#myModal">Approve/Reject<a></td>
         }
         @else{
           <td>{{ $user->status }}</td>
         }
         @endif

推荐答案

无需大括号即可直接编写

No curly braces required you can directly write

@if($user->status =='waiting')         
      <td><a href="#" class="viewPopLink btn btn-default1" role="button" data-id="{{ $user->travel_id }}" data-toggle="modal" data-target="#myModal">Approve/Reject<a></td>         
@else
      <td>{{ $user->status }}</td>        
@endif

这篇关于刀片文件中是否存在其他条件(laravel 5.3)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆