0

My pagination works right at localhost but not at server.The page counts are displayed correctly, but the first page information is only displayed.

controller :

$customers = Customer::orderBy('id','desc')->paginate(10);
return view('admin.customers_list',compact('customers'));

view :

{{$customers->links()}};

route:

Route::resource('customer','Admin\CustomersController');
19
  • Can you just remove the space between please $customers ->links ? Commented Apr 17, 2019 at 10:30
  • I think there is some problem in routes. Can you post related routes in your question and update it? Commented Apr 17, 2019 at 10:34
  • what did dd() return ? Commented Apr 17, 2019 at 10:36
  • Is pagination working fine on local? Commented Apr 17, 2019 at 10:38
  • 1
    So the issue is with routes , i think you are using apache then you need to update your .htaccess something like below <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^(.*)$ public/$1 [L] </IfModule> Commented Apr 17, 2019 at 14:10

1 Answer 1

1

If it's working fine at localhost, maybe you should check your server configuration for handling routes.

if you are using Nginx as your web server you can add these lines to your config:

location / {
    try_files $uri $uri/ /index.php?$query_string;
}

And in case of using apache:

<Directory "path/to/your/project">
    AllowOverride All
</Directory>

is necessary.

I hope it would work for you

Sign up to request clarification or add additional context in comments.

2 Comments

I'm using Apache but I don't know which file should be changed
please check if rewrite engine is enabled or not. and then you must write those lines in your sites-availbale/config file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.