当页数 = 1 时 laravel 5.3 中的分页

pagination in laravel 5.3 when count of pages = 1

我有城市 table 它有 7 个城市 我有一个视图页面来显示这些城市,每页 10 个城市

控制器:

    $cities = City::orderBy('id', 'desc')->paginate(10);
    return view('cities.home', compact('cities'));

查看:

<div class="table-responsive panel panel-sky">
                   <table class="table table-striped table-hover">
                       <tr>
                          <th>#</th>
                          <th>Name</th>
                          <th>Created At</th>
                          <th>Action</th>
                       </tr>

                       @foreach($cities as $city)
                          <tr id="product{{$city->id}}">
                             <td>{{$city->id}}</td>
                             <td>{{$city->name}}</td>
                             <td>{{ $city->created_at }}</td>
                             <td>  
                                <a href="{{ url('product/' . $city->id . '/edit') }}"><i class="glyphicon glyphicon-edit action-icon"></i></a>
                                &nbsp;&nbsp;&nbsp;&nbsp;
                                <a type="button" class="pointer" data-toggle="modal" data-target="#deleteModal" data-type="btn-danger" data-action="delete-product" data-id="{{ $city->id }}" data-msg="Are you sure you want to delete this city?" data-title="Confirm Deletion">
                                    <span class='glyphicon glyphicon-remove action-icon'></span>                                                           
                                </a>
                             </td>
                          </tr>
                       @endforeach
                   </table>
               <div>

               <div class="col-md-12"><?php echo $cities->render(); ?> </div>  

但问题是分页渲染与第 #1 页一起显示,此问题发生在 laravel5.3 并且未在 laravel5.2

中找到

如果你想以自己的方式呈现分页,可以使用paginator methods。例如,要检查是否只有一页,您可以尝试:

@if ($cities->total() > 10)
    // Render pagination
@endif