繁体   English   中英

刀片引擎元素渲染排序

[英]Blade Engine Elements Render Sorting

我有这个代码:

<div class="table-responsive">
  <table class="table table-condensed table-hover">
    <tr>
    <th>#</th>
    <th>Name</th>
    <th>username</th>
    <th>Email</th>
    <th>Rank</th>
    <th>Join</th>
  </tr>
  @if($count)
      @foreach($users as  $i => $user)
      <tr>
      <td>{{ $i+1 }}</td>
      <td>{{ $user->first_name }} {{ $user->last_name }}</td>
        <td>{{ $user->username }}</td>
        <td>{{ $user->email }}</td>
        <td>
            @if($user->rank == 0)
              Admin
            @else
              User
            @endif
        </td>
        <td>{{ $user->created_at }}</td>
        {{ Form::hidden('id', $user->id,['class'=>'id']) }}
        {{ Form::hidden('username', $user->username,['class'=>'username']) }}
        <td><button id="submit" type="button" class="btn btn-danger" data-toggle="modal" data-target="#deleteModal">
          Delete
        </button></td>
      </tr>
      @endforeach
  @else
  <div class="alert alert-success" style="text-align:center">
      There is no users in the Site
  </div>
  @endif

它使用了Blade模板引擎,但如果计数为假,则警报div出现在表格标题之前

如何解决这个问题?

我可能在这里丢失了一些东西,上面的代码似乎不完整(表未关闭)。 但是,为什么不将警报移到其他警报之外,则可以将其放置在需要的地方:

@if(!$count)
  <div class="alert alert-success" style="text-align:center">
  There is no users in the Site
  </div>
@endif

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM