2017-09-05 69 views
0

我有這樣的代碼:刀片引擎元素渲染排序

<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 

其中使用刀片模板引擎,但如果這是數是假警報格表

怎麼可以這樣的標題之前出現問題得到解決?

回答

3

我可能會錯過這裏的東西,上面的代碼似乎不完整(表不關閉)。但爲什麼不把你的警報移動到另一個之外,如果是這樣,你可以把它放在你需要的地方:

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

我忘記把表格放在代碼旁邊,好吧,我現在就試試 –