我想为我的页面使用分页,所以我在控制器中添加了这个:
$suspendeds = Order::where('status', 'awaiting')->latest()->paginate(1); return view('profile.index', compact('suspendeds'));
在刀锋上:
{{ $suspendeds->links() }}
但不知何故它看起来像这样:
所以我的问题是,如何正确加载此分页?我需要更改 CSS 样式还是由于 Laravel 的原因?如果这个问题可以在 CSS 中解决,类的名称是什么?
答案 0 :(得分:4)
检查这个https://laravel.com/docs/8.x/pagination#using-bootstrap
use Illuminate\Pagination\Paginator;
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Paginator::useBootstrap();
}
答案 1 :(得分:1)
将 render()
放在内容结束位置的末尾:
<section class="content">
<div class="row">
</div>
{!! $suspendeds->render() !!}
</section>