Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

128
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda