Laravel pagination and style - has never been easier

Simpler and more user-friendly than previous page more aravel5.3 version

1. First of all acquired data, paginate the current page method can automatically determine the correct quantity and the offset number. By default, the current number of pages by the HTTP request brought? Page parameter to decide. Of course, this value is automatically detected by Laravel, and automatically insert links generated by the pager.

如果你只想显示出上一页和下一页可以使用simplePaginate().

paginate and simplePaginate The only parameter is the number you want to display per page, this parameter specifies how many data page display.

clipboard.png

2. The view shows: Before we are likely {!! $ res-> render () !!}, version 5.3 using the following method links the following results:

clipboard.png

clipboard.png


是不是特别丑,别担心,laravel很人性化的给我们提供了样式,在public/css里面有个app.css文件,
我 们只需要再视图引入它就好了。

clipboard.png

<link rel="stylesheet" href="{{asset('css/app.css')}}">

clipboard.png

3. If you want to customize the style of how we do it? In fact, very simple, execute a command in the project

php artisan vendor:publish

After the execution of an input we can have a look: laravel bring their own style to view a copy of our catalog items following vendor folder

clipboard.png

clipboard.png

You can see the vendor / pagination Here are a few folder view file, the default is to use the default file. We just need to change inside the code can change their style, then you can also define your own use other documents, view only need to specify the file you want to use in links () method in it.

clipboard.png

Guess you like

Origin www.cnblogs.com/linqingvoe/p/11208112.html