In your view, do you actually display the pagination links?
{{ $brands->links() }}
https://laravel.com/docs/5.6/pagination#displaying-pagination-results
I think those errors are totally unrelated to showing the links.
Hi All,
I have gotten pagination working on other projects, but I am stumped with my latest one. I am using the code
$brands = Brand::latest()->paginate(2);
return view('brands.index', compact('brands'));
and in the post I can see only 2 brands. If I change the number to 3 then I will see 3 brands. The problem is I can't see the numbers/links at the bottom to switch to the next page.
I looked in my sources for errors and I get these
util.js:56 Uncaught TypeError: Cannot read property 'fn' of undefined
at util.js:56
at util.js:10
at bootstrap.min.js:6
at bootstrap.min.js:6
(anonymous) @ util.js:56
(anonymous) @ util.js:10
(anonymous) @ bootstrap.min.js:6
(anonymous) @ bootstrap.min.js:6
app.js:13941 CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token
VERSION @ app.js:13941
__webpack_require__ @ app.js:20
(anonymous) @ app.js:13884
__webpack_require__ @ app.js:20
(anonymous) @ app.js:13869
__webpack_require__ @ app.js:20
(anonymous) @ app.js:63
(anonymous) @ app.js:66
app.js:36537 [Vue warn]: Cannot find element: #app
warn @ app.js:36537
query @ app.js:41244
Vue.$mount @ app.js:46822
Vue._init @ app.js:40584
Vue @ app.js:40673
(anonymous) @ app.js:13896
__webpack_require__ @ app.js:20
(anonymous) @ app.js:13869
__webpack_require__ @ app.js:20
(anonymous) @ app.js:63
(anonymous) @ app.js:66
app.js:44510 You are running Vue in development mode.
Make sure to turn on production mode when deploying for production.
See more tips at https://vuejs.org/guide/deployment.html
I did a search for the property of 'fn' undefined but that seems an issue with jquery. So I used a cdn for the latest bootstrap css and js and Jquery but nothing seems to bring my buttons/links for the pagination
and he never enters any links() function
Sure he does, at about 8:18 just after he creates the pagination.
I've used pagination many times, and it works if you follow the docs, which I linked to.
If your controller is
$brands = Brand::latest()->paginate(2);
return view('brands.index', compact('brands'));
Then {{ $brands->links() }} should work in the brands.index view.
Is that the view you put the pagination links?
Please or to participate in this conversation.