Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

125
Views
How to paginate in laravel 8?

I've followed this documnetation (https://laravel.com/docs/8.x/pagination) and made changes accordingly but still I am not able to paginate the required page.

This is my controller code:

public function showManageCourierAddress()
{

    $viewdata = [];
    $addressRepoObj = new \App\Repositories\Mongo\CourierAddressRepository();
    $addressData = $addressRepoObj->getAddressList(0,(int)Session::get('organisation_id'));
    $viewdata['addresslist'] = $addressData;
    unset($addressData);
    
    return view('frontend.admin.managecourieraddress', ['viewdata' => DB::table('viewdata')->paginate(15)]);
}

On the view laravel, I've added this :

{{ $viewdata->links() }}

Can anyone tell me where I'm going wrong? And what I should do?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

DB::table('viewdata')->paginate(15)

returns LengthAwarePaginator instance, which implements these methods.

It is enought to call {{ $viewdata->links() }}, and it should return whole html with pagination buttons and links. You just write some styles for existing classes, or use methods as mentioned above to create your own html with your own structure.

If I did not understand your problem, please reply in comment.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!