@JARRODESTEPP - I hope, it should - nothing else is wrong with your code it seems
Try this
{{ $admins->appends(Request::except('page'))->links() }}
If you have query string on URL, you need to include those without page parameter. I suspect the reason it stays on page 1 is page=1 is included on your query string (since you have appended all) .
I think that you haven't go through with question which he has post first go and check the question,after that all I have tried it on my laravel 5.6 it's works fine.
and @jarrodestepp
can use as like below and check
{{$admins}}
You should try this:
{{ $admins->render() }}
Please check the example posted guys and stop making bizarre suggestions.
Removing namespace did not change a thing. I am starting to think its a routing issue inside laravel or something.
Original stackoverflow query
public function index()
{
$admins = Admin::latest()->paginate(1);
return view('admin.settings.admins.index', compact('admins'));
}
There are no parameters being passed.
Op,
dd ($admins);
do you get anything at all if not your query is messed up, are you sending a parameter, This has nothing to do with pagination you have messed up somewhere check your routes etc.
Work some examples from the documentation download some free code on github.
debug do a stack Trace
@jlrdw please check out all the postings. Getting results is not an issue. The paginator says there are three pages of results. The links are created. Only page 1 is returned irrespective of the page= query parameter
I'm lost where you are with this now.
Just try adding a single route at the top of web.php
Route::get('/admins/admins', 'AdminsController@index');
and then php artisan route:clear
@SNAPEY - I will try that out, but i hav figured out that the pagination only works on the Route::get('/'); (Home page only)
Try something besides that latest thing write a regular query.
Using where and the conditions.
In 5.7 I have zero trouble with pagination.
Are you guys sure it's not something wrong or an error with latest.
Can you show me one of your route files and how you structure you controllers inside Http? I need help learning how to set this up since you guys said that I was doing it in a weird way.
Show all your code, controllers, views, models, etc. Here, not an image.
This post is so long, perhaps start a new post.
@JLRDW - Do you place your controllers in subfolders for the different users or keep them all in the one directory when using 5.7?
There is nothing wrong with the samples you posted. Only your routes look suspect.
Do you place your controllers in subfolders for the different users or keep them all in the one directory when using 5.7?
No, in one app as examle I have a method:
- index for users
- indexAdmin for admins
- indexAcct for bookkeeper
But all in same controller. Example routes:
Route::get('dog/index', 'DogController@index');
Route::get('dog/indexadmin', 'DogController@indexAdmin');
Route::any('admin/acct', 'AdminController@indexAcct'); // different controller
Just test this:
$admins = DB::table('admins')
->latest()
->paginate(1);
/// then display view
Older, but read over:
@JLRDW - Okay, I have had a lot going on, sorry for not getting back sooner!
Please or to participate in this conversation.